home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / FORTH / FORTHMAC / OLD / DOCS next >
Tape Archive  |  1996-06-16  |  528.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Tape Archive (archive/tar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (old), directory !Forthmacs.risc_os.installjob., mode 700, uid 0, gid 0, size 0, seconds 6143620725, comment: Archie default
98% file data default
100% TrID TAR - Tape ARchive (directory) default
100% lsar Tar default
100% gt2 Kopftext: '!Forthmacs.risc_os.installjob.' default (weak)
100% disktype Pre-POSIX tar archive default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 21 46 6f 72 74 68 6d 61 | 63 73 2e 72 69 73 63 5f |!Forthma|cs.risc_|
|00000010| 6f 73 2e 69 6e 73 74 61 | 6c 6c 6a 6f 62 2e 00 00 |os.insta|lljob...|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 30 30 00 00 20 20 20 20 |.... 7|00.. |
|00000070| 20 30 00 00 20 20 20 20 | 20 30 00 00 20 20 20 20 | 0.. | 0.. |
|00000080| 20 20 20 20 20 20 30 00 | 20 36 31 34 33 36 32 30 | 0.| 6143620|
|00000090| 37 32 35 00 20 31 37 31 | 33 30 00 20 35 00 00 00 |725. 171|30. 5...|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 41 72 63 68 69 65 20 | 00 33 37 37 37 37 37 37 |.Archie |.3777777|
|00000110| 36 35 30 36 00 33 31 32 | 34 30 35 32 30 36 31 37 |6506.312|40520617|
|00000120| 00 20 20 20 20 20 20 20 | 20 20 20 30 00 34 36 20 |. | 0.46 |
|00000130| 63 61 38 32 61 31 38 66 | 00 00 00 00 00 00 00 00 |ca82a18f|........|
|00000140| 00 00 00 00 00 41 00 00 | 00 00 00 00 00 00 00 00 |.....A..|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 21 46 6f 72 74 68 6d 61 | 63 73 2e 72 69 73 63 5f |!Forthma|cs.risc_|
|00000210| 6f 73 2e 69 6e 73 74 61 | 6c 6c 6a 6f 62 2e 44 6f |os.insta|lljob.Do|
|00000220| 63 73 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |cs......|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 36 | 30 30 00 00 20 20 20 20 |.... 6|00.. |
|00000270| 20 30 00 00 20 20 20 20 | 20 30 00 00 20 20 20 20 | 0.. | 0.. |
|00000280| 20 20 20 20 32 34 37 00 | 20 36 31 32 30 30 31 37 | 247.| 6120017|
|00000290| 35 33 32 00 20 32 30 37 | 30 34 00 20 30 00 00 00 |532. 207|04. 0...|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 41 72 63 68 69 65 20 | 00 33 37 37 37 37 37 37 |.Archie |.3777777|
|00000310| 37 35 30 36 00 32 35 33 | 35 31 33 32 34 35 33 33 |7506.253|51324533|
|00000320| 00 20 20 20 20 20 20 20 | 20 20 20 33 00 34 36 20 |. | 3.46 |
|00000330| 61 62 61 35 61 39 35 62 | 00 20 20 20 20 20 20 20 |aba5a95b|. |
|00000340| 20 20 20 30 20 41 00 00 | 00 00 00 00 00 00 00 00 | 0 A..|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 2e 28 20 54 68 65 20 73 | 74 61 6e 64 61 72 64 20 |.( The s|tandard |
|00000410| 64 69 73 74 72 69 62 75 | 74 69 6f 6e 20 6f 66 20 |distribu|tion of |
|00000420| 64 6f 63 75 6d 65 6e 74 | 73 20 68 61 73 20 62 65 |document|s has be|
|00000430| 65 6e 20 69 6e 73 74 61 | 6c 6c 65 64 2e 29 20 63 |en insta|lled.) c|
|00000440| 72 0a 2e 28 20 50 6c 65 | 61 73 65 20 6e 6f 74 65 |r..( Ple|ase note|
|00000450| 2c 20 74 68 61 74 20 74 | 68 65 20 6e 65 77 20 70 |, that t|he new p|
|00000460| 72 69 6e 74 65 64 20 6d | 61 6e 75 61 6c 20 61 6e |rinted m|anual an|
|00000470| 64 20 74 68 65 20 48 54 | 4d 4c 20 76 65 72 73 69 |d the HT|ML versi|
|00000480| 6f 6e 29 20 63 72 0a 2e | 28 20 61 72 65 20 62 6f |on) cr..|( are bo|
|00000490| 74 68 20 61 76 61 69 6c | 61 62 6c 65 20 6e 6f 77 |th avail|able now|
|000004a0| 2e 29 20 63 72 0a 20 00 | 00 00 00 00 00 00 00 00 |.) cr. .|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 21 46 6f 72 74 68 6d 61 | 63 73 2e 64 6f 63 73 2e |!Forthma|cs.docs.|
|00000610| 61 73 63 69 69 2e 74 75 | 74 6f 72 69 61 6c 00 00 |ascii.tu|torial..|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 20 20 20 36 | 30 34 00 00 20 20 20 20 |.... 6|04.. |
|00000670| 20 30 00 00 20 20 20 20 | 20 30 00 00 20 20 20 20 | 0.. | 0.. |
|00000680| 20 20 37 33 34 33 31 00 | 20 36 31 36 30 34 36 31 | 73431.| 6160461|
|00000690| 33 37 37 00 20 32 30 30 | 35 33 00 20 30 00 00 00 |377. 200|53. 0...|
|000006a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000700| 00 41 72 63 68 69 65 20 | 00 33 37 37 37 37 37 37 |.Archie |.3777777|
|00000710| 37 35 30 36 00 33 33 36 | 34 32 30 31 33 30 33 35 |7506.336|42013035|
|00000720| 00 20 20 20 20 20 20 20 | 20 20 32 33 00 34 36 20 |. | 23.46 |
|00000730| 64 65 38 38 31 36 31 64 | 00 20 20 20 20 20 20 20 |de88161d|. |
|00000740| 20 20 20 30 20 41 00 00 | 00 00 00 00 00 00 00 00 | 0 A..|........|
|00000750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000800| 0a 46 6f 72 74 68 20 54 | 75 74 6f 72 69 61 6c 0a |.Forth T|utorial.|
|00000810| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 0a 0a |********|******..|
|00000820| 0a 54 68 69 73 20 63 68 | 61 70 74 65 72 20 69 73 |.This ch|apter is|
|00000830| 20 61 20 62 72 69 65 66 | 20 74 75 74 6f 72 69 61 | a brief| tutoria|
|00000840| 6c 20 61 62 6f 75 74 20 | 74 68 65 20 46 6f 72 74 |l about |the Fort|
|00000850| 68 20 6c 61 6e 67 75 61 | 67 65 2e 20 20 49 74 20 |h langua|ge. It |
|00000860| 77 69 6c 6c 20 0a 67 65 | 74 20 79 6f 75 20 73 74 |will .ge|t you st|
|00000870| 61 72 74 65 64 20 77 69 | 74 68 20 46 6f 72 74 68 |arted wi|th Forth|
|00000880| 2c 20 62 75 74 20 79 6f | 75 20 73 68 6f 75 6c 64 |, but yo|u should|
|00000890| 20 70 72 6f 62 61 62 6c | 79 20 62 75 79 20 61 20 | probabl|y buy a |
|000008a0| 46 6f 72 74 68 20 62 6f | 6f 6b 20 0a 74 6f 20 6c |Forth bo|ok .to l|
|000008b0| 65 61 72 6e 20 6d 6f 72 | 65 2e 20 20 0a 0a 49 66 |earn mor|e. ..If|
|000008c0| 20 79 6f 75 20 61 6c 72 | 65 61 64 79 20 6b 6e 6f | you alr|eady kno|
|000008d0| 77 20 68 6f 77 20 74 6f | 20 70 72 6f 67 72 61 6d |w how to| program|
|000008e0| 20 69 6e 20 46 6f 72 74 | 68 2c 20 79 6f 75 20 6d | in Fort|h, you m|
|000008f0| 61 79 20 73 6b 69 70 20 | 74 68 69 73 20 0a 63 68 |ay skip |this .ch|
|00000900| 61 70 74 65 72 2e 20 20 | 59 6f 75 20 6d 61 79 20 |apter. |You may |
|00000910| 77 61 6e 74 20 74 6f 20 | 6c 6f 6f 6b 20 61 74 20 |want to |look at |
|00000920| 74 68 65 20 63 68 61 70 | 74 65 72 20 22 47 6c 6f |the chap|ter "Glo|
|00000930| 73 73 61 72 79 20 46 75 | 6e 63 74 69 6f 6e 61 6c |ssary Fu|nctional|
|00000940| 20 0a 49 6e 64 65 78 22 | 2e 20 20 0a 0a 0a 46 6f | .Index"|. ...Fo|
|00000950| 72 74 68 20 69 73 20 61 | 20 63 6f 6d 70 6c 65 74 |rth is a| complet|
|00000960| 65 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 6c 61 |e progra|mming la|
|00000970| 6e 67 75 61 67 65 20 77 | 69 74 68 20 73 6f 6d 65 |nguage w|ith some|
|00000980| 20 75 6e 69 71 75 65 20 | 66 65 61 74 75 72 65 73 | unique |features|
|00000990| 2e 20 20 0a 49 6e 20 66 | 61 63 74 2c 20 69 74 20 |. .In f|act, it |
|000009a0| 69 73 20 70 72 6f 62 61 | 62 6c 79 20 75 6e 6c 69 |is proba|bly unli|
|000009b0| 6b 65 20 61 6e 79 20 6f | 74 68 65 72 20 6c 61 6e |ke any o|ther lan|
|000009c0| 67 75 61 67 65 20 79 6f | 75 20 68 61 76 65 20 65 |guage yo|u have e|
|000009d0| 76 65 72 20 75 73 65 64 | 2e 20 20 0a 50 6c 65 61 |ver used|. .Plea|
|000009e0| 73 65 20 64 6f 6e 27 74 | 20 6c 65 74 20 69 74 27 |se don't| let it'|
|000009f0| 73 20 22 73 74 72 61 6e | 67 65 6e 65 73 73 22 20 |s "stran|geness" |
|00000a00| 63 61 75 73 65 20 79 6f | 75 20 74 6f 20 69 6d 6d |cause yo|u to imm|
|00000a10| 65 64 69 61 74 65 6c 79 | 20 72 65 6a 65 63 74 20 |ediately| reject |
|00000a20| 69 74 20 0a 2d 2d 2d 20 | 6f 6e 63 65 20 79 6f 75 |it .--- |once you|
|00000a30| 20 67 65 74 20 75 73 65 | 64 20 74 6f 20 69 74 2c | get use|d to it,|
|00000a40| 20 79 6f 75 20 6d 61 79 | 20 66 69 6e 64 20 74 68 | you may| find th|
|00000a50| 61 74 20 79 6f 75 20 63 | 61 6e 20 75 73 65 20 46 |at you c|an use F|
|00000a60| 6f 72 74 68 20 74 6f 20 | 0a 77 72 69 74 65 20 77 |orth to |.write w|
|00000a70| 6f 72 6b 69 6e 67 20 70 | 72 6f 67 72 61 6d 73 20 |orking p|rograms |
|00000a80| 66 61 73 74 65 72 20 74 | 68 61 6e 20 79 6f 75 20 |faster t|han you |
|00000a90| 65 76 65 72 20 64 72 65 | 61 6d 65 64 20 70 6f 73 |ever dre|amed pos|
|00000aa0| 73 69 62 6c 65 2e 20 20 | 0a 0a 46 6f 72 74 68 20 |sible. |..Forth |
|00000ab0| 69 73 20 6f 66 74 65 6e | 20 64 65 73 63 72 69 62 |is often| describ|
|00000ac0| 65 64 20 61 73 20 61 6e | 20 61 73 73 65 6d 62 6c |ed as an| assembl|
|00000ad0| 65 72 2c 20 63 6f 6d 70 | 69 6c 65 72 2c 20 6f 70 |er, comp|iler, op|
|00000ae0| 65 72 61 74 69 6e 67 20 | 73 79 73 74 65 6d 2c 20 |erating |system, |
|00000af0| 0a 65 64 69 74 6f 72 2c | 20 61 6e 64 20 63 6f 6d |.editor,| and com|
|00000b00| 6d 61 6e 64 20 6c 61 6e | 67 75 61 67 65 20 61 6c |mand lan|guage al|
|00000b10| 6c 20 72 6f 6c 6c 65 64 | 20 69 6e 74 6f 20 6f 6e |l rolled| into on|
|00000b20| 65 2e 20 20 49 6e 20 61 | 64 64 69 74 69 6f 6e 2c |e. In a|ddition,|
|00000b30| 20 6d 6f 73 74 20 0a 6f | 66 20 74 68 65 20 46 6f | most .o|f the Fo|
|00000b40| 72 74 68 20 73 79 73 74 | 65 6d 20 69 73 20 77 72 |rth syst|em is wr|
|00000b50| 69 74 74 65 6e 20 69 6e | 20 46 6f 72 74 68 2e 20 |itten in| Forth. |
|00000b60| 20 0a 0a 54 6f 20 66 69 | 6e 64 20 6f 75 74 20 6d | ..To fi|nd out m|
|00000b70| 6f 72 65 20 61 62 6f 75 | 74 20 79 6f 75 72 20 52 |ore abou|t your R|
|00000b80| 49 53 43 20 4f 53 20 46 | 6f 72 74 68 6d 61 63 73 |ISC OS F|orthmacs|
|00000b90| 20 73 79 73 74 65 6d 20 | 74 72 79 20 0a 20 20 20 | system |try . |
|00000ba0| 20 77 6f 72 64 73 0a 20 | 20 20 20 73 65 65 20 77 | words. | see w|
|00000bb0| 6f 72 64 73 0a 20 20 20 | 20 77 68 61 74 69 73 20 |ords. | whatis |
|00000bc0| 77 6f 72 64 73 0a 6f 72 | 20 6f 74 68 65 72 73 2e |words.or| others.|
|00000bd0| 20 20 0a 0a 0a 47 65 74 | 74 69 6e 67 20 53 74 61 | ...Get|ting Sta|
|00000be0| 72 74 65 64 0a 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |rted.===|========|
|00000bf0| 3d 3d 3d 3d 0a 0a 49 66 | 20 79 6f 75 20 73 69 74 |====..If| you sit|
|00000c00| 20 64 6f 77 6e 20 74 6f | 20 61 20 63 6f 6d 70 75 | down to| a compu|
|00000c10| 74 65 72 20 72 75 6e 6e | 69 6e 67 20 46 6f 72 74 |ter runn|ing Fort|
|00000c20| 68 2c 20 79 6f 75 27 6c | 6c 20 70 72 6f 62 61 62 |h, you'l|l probab|
|00000c30| 6c 79 20 73 65 65 20 74 | 68 65 20 0a 77 6f 72 64 |ly see t|he .word|
|00000c40| 20 4f 4b 20 72 69 67 68 | 74 20 62 65 66 6f 72 65 | OK righ|t before|
|00000c50| 20 74 68 65 20 63 75 72 | 73 6f 72 2e 20 20 4f 4b | the cur|sor. OK|
|00000c60| 20 69 73 20 74 68 65 20 | 22 70 72 6f 6d 70 74 22 | is the |"prompt"|
|00000c70| 2e 20 20 49 74 20 6d 65 | 61 6e 73 20 74 68 61 74 |. It me|ans that|
|00000c80| 20 0a 46 6f 72 74 68 20 | 69 73 20 72 65 61 64 79 | .Forth |is ready|
|00000c90| 20 66 6f 72 20 79 6f 75 | 20 74 6f 20 74 79 70 65 | for you| to type|
|00000ca0| 20 73 6f 6d 65 74 68 69 | 6e 67 2e 20 20 53 75 70 | somethi|ng. Sup|
|00000cb0| 70 6f 73 65 20 79 6f 75 | 20 74 79 70 65 20 0a 0a |pose you| type ..|
|00000cc0| 31 20 32 20 2b 20 2e 0a | 0a 41 6c 77 61 79 73 20 |1 2 + ..|.Always |
|00000cd0| 74 79 70 65 20 74 68 65 | 20 63 72 2c 20 52 65 74 |type the| cr, Ret|
|00000ce0| 75 72 6e 2c 20 6c 66 2c | 20 4c 69 6e 65 66 65 65 |urn, lf,| Linefee|
|00000cf0| 64 2c 20 6f 72 20 77 68 | 61 74 65 76 65 72 20 65 |d, or wh|atever e|
|00000d00| 71 75 69 76 61 6c 65 6e | 74 20 6b 65 79 20 0a 79 |quivalen|t key .y|
|00000d10| 6f 75 72 20 74 65 72 6d | 69 6e 61 6c 20 68 61 73 |our term|inal has|
|00000d20| 2c 20 61 74 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |, at the| end of |
|00000d30| 74 68 65 20 6c 69 6e 65 | 2e 20 20 46 6f 72 74 68 |the line|. Forth|
|00000d40| 20 77 69 6c 6c 20 72 65 | 73 70 6f 6e 64 20 77 69 | will re|spond wi|
|00000d50| 74 68 20 0a 0a 33 0a 0a | 59 6f 75 20 68 61 76 65 |th ..3..|You have|
|00000d60| 20 6a 75 73 74 20 61 64 | 64 65 64 20 31 20 61 6e | just ad|ded 1 an|
|00000d70| 64 20 32 2c 20 61 6e 64 | 20 70 72 69 6e 74 65 64 |d 2, and| printed|
|00000d80| 20 74 68 65 20 72 65 73 | 75 6c 74 2e 20 20 0a 0a | the res|ult. ..|
|00000d90| 49 20 61 6d 20 67 6f 69 | 6e 67 20 74 6f 20 61 73 |I am goi|ng to as|
|00000da0| 73 75 6d 65 20 61 74 20 | 74 68 69 73 20 70 6f 69 |sume at |this poi|
|00000db0| 6e 74 20 74 68 61 74 20 | 79 6f 75 20 75 6e 64 65 |nt that |you unde|
|00000dc0| 72 73 74 61 6e 64 20 74 | 68 65 20 63 6f 6e 63 65 |rstand t|he conce|
|00000dd0| 70 74 20 6f 66 20 0a 61 | 20 73 74 61 63 6b 2e 20 |pt of .a| stack. |
|00000de0| 20 46 6f 72 74 68 20 75 | 73 65 73 20 73 74 61 63 | Forth u|ses stac|
|00000df0| 6b 73 20 68 65 61 76 69 | 6c 79 2e 20 20 49 6e 20 |ks heavi|ly. In |
|00000e00| 66 61 63 74 2c 20 74 68 | 65 20 63 6f 6e 73 69 73 |fact, th|e consis|
|00000e10| 74 65 6e 74 20 73 74 61 | 63 6b 20 0a 6f 72 69 65 |tent sta|ck .orie|
|00000e20| 6e 74 61 74 69 6f 6e 20 | 69 73 20 74 68 65 20 6b |ntation |is the k|
|00000e30| 65 79 20 74 6f 20 46 6f | 72 74 68 27 73 20 61 62 |ey to Fo|rth's ab|
|00000e40| 69 6c 69 74 79 20 74 6f | 20 70 61 63 6b 20 61 20 |ility to| pack a |
|00000e50| 6c 6f 74 20 6f 66 20 63 | 61 70 61 62 69 6c 69 74 |lot of c|apabilit|
|00000e60| 79 20 0a 69 6e 20 61 20 | 73 6d 61 6c 6c 20 61 6d |y .in a |small am|
|00000e70| 6f 75 6e 74 20 6f 66 20 | 6d 65 6d 6f 72 79 2e 20 |ount of |memory. |
|00000e80| 20 0a 0a 47 6f 69 6e 67 | 20 62 61 63 6b 20 74 6f | ..Going| back to|
|00000e90| 20 6f 75 72 20 65 78 61 | 6d 70 6c 65 2c 20 74 79 | our exa|mple, ty|
|00000ea0| 70 69 6e 67 20 22 31 22 | 20 63 61 75 73 65 64 20 |ping "1"| caused |
|00000eb0| 74 68 65 20 6e 75 6d 62 | 65 72 20 31 20 74 6f 20 |the numb|er 1 to |
|00000ec0| 62 65 20 70 75 73 68 65 | 64 20 0a 6f 6e 74 6f 20 |be pushe|d .onto |
|00000ed0| 46 6f 72 74 68 27 73 20 | 6d 61 69 6e 20 73 74 61 |Forth's |main sta|
|00000ee0| 63 6b 2c 20 77 68 69 63 | 68 20 69 73 20 63 61 6c |ck, whic|h is cal|
|00000ef0| 6c 65 64 20 74 68 65 20 | 64 61 74 61 20 73 74 61 |led the |data sta|
|00000f00| 63 6b 2e 20 20 54 79 70 | 69 6e 67 20 22 32 22 20 |ck. Typ|ing "2" |
|00000f10| 0a 63 61 75 73 65 64 20 | 74 68 65 20 6e 75 6d 62 |.caused |the numb|
|00000f20| 65 72 20 32 20 74 6f 20 | 62 65 20 70 75 73 68 65 |er 2 to |be pushe|
|00000f30| 64 20 6f 6e 74 6f 20 74 | 68 65 20 73 61 6d 65 20 |d onto t|he same |
|00000f40| 73 74 61 63 6b 2c 20 6f | 6e 20 74 6f 70 20 6f 66 |stack, o|n top of|
|00000f50| 20 74 68 65 20 31 2e 20 | 20 0a 54 68 65 20 22 2b | the 1. | .The "+|
|00000f60| 22 20 63 61 75 73 65 64 | 20 74 77 6f 20 6e 75 6d |" caused| two num|
|00000f70| 62 65 72 73 20 74 6f 20 | 62 65 20 70 6f 70 70 65 |bers to |be poppe|
|00000f80| 64 20 6f 66 66 20 74 68 | 65 20 73 74 61 63 6b 2c |d off th|e stack,|
|00000f90| 20 69 6e 20 74 68 69 73 | 20 63 61 73 65 20 31 20 | in this| case 1 |
|00000fa0| 0a 61 6e 64 20 32 2e 20 | 20 54 68 65 20 6e 75 6d |.and 2. | The num|
|00000fb0| 62 65 72 73 20 77 65 72 | 65 20 61 64 64 65 64 20 |bers wer|e added |
|00000fc0| 74 6f 67 65 74 68 65 72 | 20 61 6e 64 20 74 68 65 |together| and the|
|00000fd0| 20 72 65 73 75 6c 74 20 | 77 61 73 20 70 75 74 20 | result |was put |
|00000fe0| 62 61 63 6b 20 6f 6e 20 | 0a 74 68 65 20 73 74 61 |back on |.the sta|
|00000ff0| 63 6b 2e 20 20 54 68 65 | 20 22 2e 22 20 63 61 75 |ck. The| "." cau|
|00001000| 73 65 64 20 61 20 6e 75 | 6d 62 65 72 20 74 6f 20 |sed a nu|mber to |
|00001010| 62 65 20 70 6f 70 70 65 | 64 20 6f 66 66 20 74 68 |be poppe|d off th|
|00001020| 65 20 73 74 61 63 6b 2c | 20 69 6e 20 0a 74 68 69 |e stack,| in .thi|
|00001030| 73 20 63 61 73 65 20 33 | 2c 20 61 6e 64 20 70 72 |s case 3|, and pr|
|00001040| 69 6e 74 65 64 20 6f 6e | 20 74 68 65 20 74 65 72 |inted on| the ter|
|00001050| 6d 69 6e 61 6c 2e 20 20 | 0a 0a 49 66 20 79 6f 75 |minal. |..If you|
|00001060| 20 68 61 76 65 20 61 6e | 20 48 50 20 63 61 6c 63 | have an| HP calc|
|00001070| 75 6c 61 74 6f 72 2c 20 | 6e 6f 20 64 6f 75 62 74 |ulator, |no doubt|
|00001080| 20 74 68 69 73 20 73 6f | 75 6e 64 73 20 76 65 72 | this so|unds ver|
|00001090| 79 20 66 61 6d 69 6c 69 | 61 72 20 74 6f 20 0a 79 |y famili|ar to .y|
|000010a0| 6f 75 2e 20 20 41 6e 20 | 69 6d 70 6f 72 74 61 6e |ou. An |importan|
|000010b0| 74 20 64 69 66 66 65 72 | 65 6e 63 65 73 20 69 73 |t differ|ences is|
|000010c0| 20 74 68 61 74 20 48 50 | 20 63 61 6c 63 75 6c 61 | that HP| calcula|
|000010d0| 74 6f 72 73 20 68 61 76 | 65 20 61 20 73 74 61 63 |tors hav|e a stac|
|000010e0| 6b 20 0a 74 68 61 74 20 | 69 73 20 34 20 6e 75 6d |k .that |is 4 num|
|000010f0| 62 65 72 73 20 64 65 65 | 70 2c 20 77 68 65 72 65 |bers dee|p, where|
|00001100| 61 73 20 46 6f 72 74 68 | 27 73 20 73 74 61 63 6b |as Forth|'s stack|
|00001110| 20 69 73 20 6d 75 63 68 | 20 6c 61 72 67 65 72 2c | is much| larger,|
|00001120| 20 0a 74 79 70 69 63 61 | 6c 6c 79 20 6d 6f 72 65 | .typica|lly more|
|00001130| 20 74 68 61 6e 20 36 34 | 20 6e 75 6d 62 65 72 73 | than 64| numbers|
|00001140| 2e 20 20 49 6e 20 52 49 | 53 43 20 4f 53 20 46 6f |. In RI|SC OS Fo|
|00001150| 72 74 68 6d 61 63 73 20 | 74 68 69 73 20 69 73 20 |rthmacs |this is |
|00001160| 50 53 2d 53 49 5a 45 20 | 0a 64 69 76 69 64 65 64 |PS-SIZE |.divided|
|00001170| 20 62 79 20 74 68 65 20 | 63 65 6c 6c 20 73 69 7a | by the |cell siz|
|00001180| 65 2e 20 20 0a 0a 4f 74 | 68 65 72 20 61 72 69 74 |e. ..Ot|her arit|
|00001190| 68 6d 65 74 69 63 20 6f | 70 65 72 61 74 6f 72 73 |hmetic o|perators|
|000011a0| 20 74 68 61 74 20 46 6f | 72 74 68 20 6b 6e 6f 77 | that Fo|rth know|
|000011b0| 73 20 61 62 6f 75 74 20 | 61 72 65 20 2d 20 28 6d |s about |are - (m|
|000011c0| 69 6e 75 73 29 2c 20 2a | 20 0a 28 74 69 6d 65 73 |inus), *| .(times|
|000011d0| 29 2c 20 61 6e 64 20 2f | 20 28 64 69 76 69 64 65 |), and /| (divide|
|000011e0| 29 2c 20 61 73 20 77 65 | 6c 6c 20 61 20 73 6f 6d |), as we|ll a som|
|000011f0| 65 20 6f 74 68 65 72 73 | 20 74 68 61 74 20 77 65 |e others| that we|
|00001200| 27 6c 6c 20 77 6f 72 72 | 79 20 61 62 6f 75 74 20 |'ll worr|y about |
|00001210| 0a 6c 61 74 65 72 2e 20 | 20 54 68 65 20 61 72 69 |.later. | The ari|
|00001220| 74 68 6d 65 74 69 63 20 | 69 73 20 70 65 72 66 6f |thmetic |is perfo|
|00001230| 72 6d 65 64 20 61 73 20 | 33 32 2d 62 69 74 20 69 |rmed as |32-bit i|
|00001240| 6e 74 65 67 65 72 20 61 | 72 69 74 68 6d 65 74 69 |nteger a|rithmeti|
|00001250| 63 2c 20 0a 61 6c 74 68 | 6f 75 67 68 20 74 68 65 |c, .alth|ough the|
|00001260| 72 65 20 61 72 65 20 6f | 70 65 72 61 74 6f 72 73 |re are o|perators|
|00001270| 20 77 68 69 63 68 20 77 | 69 6c 6c 20 63 6f 70 65 | which w|ill cope|
|00001280| 20 77 69 74 68 20 6f 74 | 68 65 72 20 6b 69 6e 64 | with ot|her kind|
|00001290| 73 20 6f 66 20 0a 6e 75 | 6d 62 65 72 73 2e 20 20 |s of .nu|mbers. |
|000012a0| 0a 0a 0a 44 65 66 69 6e | 69 6e 67 20 79 6f 75 72 |...Defin|ing your|
|000012b0| 20 6f 77 6e 20 77 6f 72 | 64 73 0a 3d 3d 3d 3d 3d | own wor|ds.=====|
|000012c0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|000012d0| 3d 3d 0a 0a 41 20 46 6f | 72 74 68 20 73 79 73 74 |==..A Fo|rth syst|
|000012e0| 65 6d 20 75 6e 64 65 72 | 73 74 61 6e 64 73 20 61 |em under|stands a|
|000012f0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 22 77 6f 72 64 | number |of "word|
|00001300| 73 22 2c 20 65 61 63 68 | 20 6f 66 20 77 68 69 63 |s", each| of whic|
|00001310| 68 20 63 61 75 73 65 73 | 20 0a 73 6f 6d 65 74 68 |h causes| .someth|
|00001320| 69 6e 67 20 74 6f 20 68 | 61 70 70 65 6e 2c 20 75 |ing to h|appen, u|
|00001330| 73 75 61 6c 6c 79 20 74 | 6f 20 74 68 65 20 73 74 |sually t|o the st|
|00001340| 61 63 6b 2e 20 20 49 6e | 20 6f 75 72 20 65 78 61 |ack. In| our exa|
|00001350| 6d 70 6c 65 2c 20 22 2b | 22 20 61 6e 64 20 0a 22 |mple, "+|" and ."|
|00001360| 2e 22 20 77 65 72 65 20 | 62 6f 74 68 20 77 6f 72 |." were |both wor|
|00001370| 64 73 2e 20 20 59 6f 75 | 20 63 61 6e 20 64 65 66 |ds. You| can def|
|00001380| 69 6e 65 20 79 6f 75 72 | 20 6f 77 6e 20 77 6f 72 |ine your| own wor|
|00001390| 64 73 20 69 6e 20 74 65 | 72 6d 73 20 6f 66 20 77 |ds in te|rms of w|
|000013a0| 6f 72 64 73 20 0a 74 68 | 65 20 73 79 73 74 65 6d |ords .th|e system|
|000013b0| 20 61 6c 72 65 61 64 79 | 20 6b 6e 6f 77 73 2e 20 | already| knows. |
|000013c0| 20 4f 6e 63 65 20 64 65 | 66 69 6e 65 64 2c 20 79 | Once de|fined, y|
|000013d0| 6f 75 72 20 77 6f 72 64 | 73 20 6d 61 79 20 62 65 |our word|s may be|
|000013e0| 20 75 73 65 64 20 6a 75 | 73 74 20 0a 61 73 20 74 | used ju|st .as t|
|000013f0| 68 6f 75 67 68 20 74 68 | 65 79 20 74 68 65 79 20 |hough th|ey they |
|00001400| 77 65 72 65 20 73 79 73 | 74 65 6d 20 77 6f 72 64 |were sys|tem word|
|00001410| 73 2e 20 20 41 6e 6f 74 | 68 65 72 20 65 78 61 6d |s. Anot|her exam|
|00001420| 70 6c 65 3a 20 0a 0a 3a | 20 61 64 64 70 72 69 6e |ple: ..:| addprin|
|00001430| 74 20 20 20 2b 20 2e 20 | 20 20 3b 0a 0a 48 65 72 |t + . | ;..Her|
|00001440| 65 2c 20 74 68 65 20 22 | 3a 22 2c 20 77 68 69 63 |e, the "|:", whic|
|00001450| 68 20 69 73 20 61 20 73 | 79 73 74 65 6d 20 77 6f |h is a s|ystem wo|
|00001460| 72 64 2c 20 63 61 75 73 | 65 73 20 61 20 6e 65 77 |rd, caus|es a new|
|00001470| 20 77 6f 72 64 20 74 6f | 20 62 65 20 0a 64 65 66 | word to| be .def|
|00001480| 69 6e 65 64 2c 20 69 6e | 20 74 68 69 73 20 63 61 |ined, in| this ca|
|00001490| 73 65 20 61 64 64 70 72 | 69 6e 74 2e 20 20 54 68 |se addpr|int. Th|
|000014a0| 65 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 6f 66 20 |e defini|tion of |
|000014b0| 61 64 64 70 72 69 6e 74 | 20 69 73 20 28 42 20 2b |addprint| is (B +|
|000014c0| 20 2e 20 20 0a 29 2c 20 | 77 68 69 63 68 20 6d 65 | . .), |which me|
|000014d0| 61 6e 73 20 74 68 61 74 | 20 77 68 65 6e 20 79 6f |ans that| when yo|
|000014e0| 75 20 65 78 65 63 75 74 | 65 20 61 64 64 70 72 69 |u execut|e addpri|
|000014f0| 6e 74 2c 20 74 77 6f 20 | 6e 75 6d 62 65 72 73 20 |nt, two |numbers |
|00001500| 77 69 6c 6c 20 62 65 20 | 0a 74 61 6b 65 6e 20 66 |will be |.taken f|
|00001510| 72 6f 6d 20 74 68 65 20 | 73 74 61 63 6b 20 61 6e |rom the |stack an|
|00001520| 64 20 74 68 65 20 73 75 | 6d 20 70 72 69 6e 74 65 |d the su|m printe|
|00001530| 64 2e 20 20 54 68 65 20 | 3b 2c 20 61 6e 6f 74 68 |d. The |;, anoth|
|00001540| 65 72 20 73 79 73 74 65 | 6d 20 77 6f 72 64 2c 20 |er syste|m word, |
|00001550| 0a 74 65 72 6d 69 6e 61 | 74 65 73 20 74 68 65 20 |.termina|tes the |
|00001560| 64 65 66 69 6e 69 74 69 | 6f 6e 2e 20 20 49 66 20 |definiti|on. If |
|00001570| 79 6f 75 20 77 65 72 65 | 20 74 6f 20 6c 61 74 65 |you were| to late|
|00001580| 72 20 74 79 70 65 20 0a | 0a 32 33 20 34 35 20 61 |r type .|.23 45 a|
|00001590| 64 64 70 72 69 6e 74 0a | 0a 46 6f 72 74 68 20 77 |ddprint.|.Forth w|
|000015a0| 6f 75 6c 64 20 72 65 73 | 70 6f 6e 64 20 77 69 74 |ould res|pond wit|
|000015b0| 68 20 0a 0a 36 38 0a 0a | 41 20 64 65 66 69 6e 69 |h ..68..|A defini|
|000015c0| 74 69 6f 6e 20 6f 66 20 | 74 68 69 73 20 73 6f 72 |tion of |this sor|
|000015d0| 74 20 69 73 20 63 61 6c | 6c 65 64 20 61 20 22 63 |t is cal|led a "c|
|000015e0| 6f 6c 6f 6e 20 64 65 66 | 69 6e 69 74 69 6f 6e 22 |olon def|inition"|
|000015f0| 2e 20 20 41 20 0a 64 69 | 73 74 69 6e 67 75 69 73 |. A .di|stinguis|
|00001600| 68 69 6e 67 20 63 68 61 | 72 61 63 74 65 72 69 73 |hing cha|racteris|
|00001610| 74 69 63 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |tic is t|hat the |
|00001620| 6e 65 77 20 77 6f 72 64 | 20 69 73 20 64 65 66 69 |new word| is defi|
|00001630| 6e 65 64 20 69 6e 20 74 | 65 72 6d 73 20 0a 6f 66 |ned in t|erms .of|
|00001640| 20 6f 74 68 65 72 20 46 | 6f 72 74 68 20 77 6f 72 | other F|orth wor|
|00001650| 64 73 2e 20 20 49 74 20 | 69 73 20 61 6c 73 6f 20 |ds. It |is also |
|00001660| 70 6f 73 73 69 62 6c 65 | 20 74 6f 20 64 65 66 69 |possible| to defi|
|00001670| 6e 65 20 61 20 77 6f 72 | 64 20 69 6e 20 74 65 72 |ne a wor|d in ter|
|00001680| 6d 73 20 0a 6f 66 20 74 | 68 65 20 61 73 73 65 6d |ms .of t|he assem|
|00001690| 62 6c 79 20 6c 61 6e 67 | 75 61 67 65 20 6f 66 20 |bly lang|uage of |
|000016a0| 74 68 65 20 6d 61 63 68 | 69 6e 65 20 79 6f 75 20 |the mach|ine you |
|000016b0| 61 72 65 20 61 63 74 75 | 61 6c 6c 79 20 72 75 6e |are actu|ally run|
|000016c0| 6e 69 6e 67 20 6f 6e 2e | 20 20 0a 54 68 69 73 20 |ning on.| .This |
|000016d0| 6b 69 6e 64 20 6f 66 20 | 64 65 66 69 6e 69 74 69 |kind of |definiti|
|000016e0| 6f 6e 20 69 73 20 63 61 | 6c 6c 65 64 20 61 20 22 |on is ca|lled a "|
|000016f0| 63 6f 64 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 22 |code def|inition"|
|00001700| 2c 20 61 6e 64 20 69 73 | 20 6e 6f 74 20 75 73 65 |, and is| not use|
|00001710| 64 20 0a 6e 65 61 72 6c | 79 20 61 73 20 6f 66 74 |d .nearl|y as oft|
|00001720| 65 6e 20 61 73 20 63 6f | 6c 6f 6e 20 64 65 66 69 |en as co|lon defi|
|00001730| 6e 69 74 69 6f 6e 73 2e | 20 20 0a 0a 49 66 20 79 |nitions.| ..If y|
|00001740| 6f 75 20 77 69 73 68 65 | 64 20 74 6f 20 6c 61 74 |ou wishe|d to lat|
|00001750| 65 72 20 75 73 65 20 61 | 64 64 70 72 69 6e 74 20 |er use a|ddprint |
|00001760| 69 6e 20 74 68 65 20 64 | 65 66 69 6e 69 74 69 6f |in the d|efinitio|
|00001770| 6e 20 6f 66 20 61 6e 6f | 74 68 65 72 20 77 6f 72 |n of ano|ther wor|
|00001780| 64 2c 20 0a 79 6f 75 20 | 63 6f 75 6c 64 20 64 6f |d, .you |could do|
|00001790| 20 73 6f 20 6a 75 73 74 | 20 61 73 20 74 68 6f 75 | so just| as thou|
|000017a0| 67 68 20 61 64 64 70 72 | 69 6e 74 20 77 65 72 65 |gh addpr|int were|
|000017b0| 20 61 20 73 79 73 74 65 | 6d 2d 73 75 70 70 6c 69 | a syste|m-suppli|
|000017c0| 65 64 20 77 6f 72 64 2e | 20 20 0a 0a 3a 20 61 64 |ed word.| ..: ad|
|000017d0| 64 70 72 69 6e 74 32 20 | 61 64 64 70 72 69 6e 74 |dprint2 |addprint|
|000017e0| 20 61 64 64 70 72 69 6e | 74 20 3b 0a 31 20 32 20 | addprin|t ;.1 2 |
|000017f0| 33 20 34 20 20 61 64 64 | 70 72 69 6e 74 32 0a 0a |3 4 add|print2..|
|00001800| 77 6f 75 6c 64 20 72 65 | 73 75 6c 74 20 69 6e 20 |would re|sult in |
|00001810| 0a 0a 37 20 33 0a 0a 4e | 6f 74 65 20 74 68 65 20 |..7 3..N|ote the |
|00001820| 6f 72 64 65 72 20 69 6e | 20 77 68 69 63 68 20 74 |order in| which t|
|00001830| 68 65 20 6e 75 6d 62 65 | 72 73 20 77 65 72 65 20 |he numbe|rs were |
|00001840| 61 64 64 65 64 2e 20 20 | 54 68 65 20 72 65 61 73 |added. |The reas|
|00001850| 6f 6e 20 69 73 20 74 68 | 61 74 2c 20 0a 77 68 65 |on is th|at, .whe|
|00001860| 6e 20 61 64 64 70 72 69 | 6e 74 32 20 69 73 20 65 |n addpri|nt2 is e|
|00001870| 78 65 63 75 74 65 64 2c | 20 34 20 69 73 20 6f 6e |xecuted,| 4 is on|
|00001880| 20 74 6f 70 20 6f 66 20 | 74 68 65 20 73 74 61 63 | top of |the stac|
|00001890| 6b 2c 20 77 69 74 68 20 | 33 20 0a 75 6e 64 65 72 |k, with |3 .under|
|000018a0| 6e 65 61 74 68 20 69 74 | 2e 20 20 54 68 65 20 66 |neath it|. The f|
|000018b0| 69 72 73 74 20 61 64 64 | 69 74 69 6f 6e 20 77 69 |irst add|ition wi|
|000018c0| 6c 6c 20 74 68 75 73 20 | 62 65 20 33 2b 34 2e 20 |ll thus |be 3+4. |
|000018d0| 20 0a 0a 49 74 20 69 73 | 20 69 6d 70 6f 72 74 61 | ..It is| importa|
|000018e0| 6e 74 20 74 6f 20 6b 65 | 65 70 20 74 72 61 63 6b |nt to ke|ep track|
|000018f0| 20 6f 66 20 77 68 61 74 | 20 69 73 20 6f 6e 20 74 | of what| is on t|
|00001900| 68 65 20 73 74 61 63 6b | 20 77 68 65 6e 20 79 6f |he stack| when yo|
|00001910| 75 20 61 72 65 20 0a 77 | 72 69 74 69 6e 67 20 46 |u are .w|riting F|
|00001920| 6f 72 74 68 20 70 72 6f | 67 72 61 6d 73 2e 20 20 |orth pro|grams. |
|00001930| 41 6e 20 65 73 73 65 6e | 74 69 61 6c 20 70 61 72 |An essen|tial par|
|00001940| 74 20 6f 66 20 74 68 65 | 20 64 6f 63 75 6d 65 6e |t of the| documen|
|00001950| 74 61 74 69 6f 6e 20 6f | 66 20 61 20 0a 46 6f 72 |tation o|f a .For|
|00001960| 74 68 20 77 6f 72 64 20 | 69 73 20 61 20 73 74 61 |th word |is a sta|
|00001970| 63 6b 20 64 69 61 67 72 | 61 6d 2e 20 20 41 20 73 |ck diagr|am. A s|
|00001980| 74 61 63 6b 20 64 69 61 | 67 72 61 6d 20 73 68 6f |tack dia|gram sho|
|00001990| 77 73 20 77 68 61 74 20 | 74 68 65 20 77 6f 72 64 |ws what |the word|
|000019a0| 20 0a 65 78 70 65 63 74 | 73 20 74 6f 20 62 65 20 | .expect|s to be |
|000019b0| 6f 6e 20 74 68 65 20 73 | 74 61 63 6b 20 77 68 65 |on the s|tack whe|
|000019c0| 6e 20 69 74 20 73 74 61 | 72 74 73 20 65 78 65 63 |n it sta|rts exec|
|000019d0| 75 74 69 6e 67 2c 20 61 | 6e 64 20 77 68 61 74 20 |uting, a|nd what |
|000019e0| 69 74 20 0a 6c 65 61 76 | 65 73 20 6f 6e 20 74 68 |it .leav|es on th|
|000019f0| 65 20 73 74 61 63 6b 20 | 61 66 74 65 72 20 69 74 |e stack |after it|
|00001a00| 20 69 73 20 66 69 6e 69 | 73 68 65 64 2e 20 20 54 | is fini|shed. T|
|00001a10| 68 65 20 73 74 61 63 6b | 20 64 69 61 67 72 61 6d |he stack| diagram|
|00001a20| 20 66 6f 72 20 0a 61 64 | 64 70 72 69 6e 74 20 77 | for .ad|dprint w|
|00001a30| 6f 75 6c 64 20 62 65 20 | 0a 0a 28 20 6e 31 20 6e |ould be |..( n1 n|
|00001a40| 32 20 2d 2d 20 73 75 6d | 20 29 0a 0a 73 68 6f 77 |2 -- sum| )..show|
|00001a50| 69 6e 67 20 74 68 61 74 | 20 74 77 6f 20 6e 75 6d |ing that| two num|
|00001a60| 62 65 72 73 20 28 20 6e | 31 20 61 6e 64 20 6e 32 |bers ( n|1 and n2|
|00001a70| 20 29 20 61 72 65 20 65 | 78 70 65 63 74 65 64 20 | ) are e|xpected |
|00001a80| 74 6f 20 62 65 20 6f 6e | 20 74 68 65 20 73 74 61 |to be on| the sta|
|00001a90| 63 6b 20 0a 61 74 20 74 | 68 65 20 73 74 61 72 74 |ck .at t|he start|
|00001aa0| 2c 20 61 6e 64 20 74 68 | 61 74 20 61 64 64 70 72 |, and th|at addpr|
|00001ab0| 69 6e 74 20 6c 65 61 76 | 65 73 20 6f 6e 65 20 6e |int leav|es one n|
|00001ac0| 75 6d 62 65 72 20 6f 6e | 20 74 68 65 20 73 74 61 |umber on| the sta|
|00001ad0| 63 6b 20 28 20 73 75 6d | 20 29 20 0a 77 68 65 6e |ck ( sum| ) .when|
|00001ae0| 20 69 74 20 69 73 20 66 | 69 6e 69 73 68 65 64 2e | it is f|inished.|
|00001af0| 20 20 54 68 65 20 22 2d | 2d 22 20 73 68 6f 77 73 | The "-|-" shows|
|00001b00| 20 77 68 65 72 65 20 74 | 68 65 20 77 6f 72 64 20 | where t|he word |
|00001b10| 65 78 65 63 75 74 65 73 | 2c 20 6f 72 2c 20 69 6e |executes|, or, in|
|00001b20| 20 0a 6f 74 68 65 72 20 | 77 6f 72 64 73 2c 20 69 | .other |words, i|
|00001b30| 74 20 73 65 70 61 72 61 | 74 65 73 20 74 68 65 20 |t separa|tes the |
|00001b40| 69 6e 70 75 74 20 70 61 | 72 61 6d 65 74 65 72 73 |input pa|rameters|
|00001b50| 20 66 72 6f 6d 20 74 68 | 65 20 6f 75 74 70 75 74 | from th|e output|
|00001b60| 20 0a 70 61 72 61 6d 65 | 74 65 72 73 2e 20 20 0a | .parame|ters. .|
|00001b70| 0a 53 74 61 63 6b 20 64 | 69 61 67 72 61 6d 73 20 |.Stack d|iagrams |
|00001b80| 61 72 65 20 65 6e 63 6c | 6f 73 65 64 20 69 6e 20 |are encl|osed in |
|00001b90| 70 61 72 65 6e 74 68 65 | 73 65 73 2c 20 62 65 63 |parenthe|ses, bec|
|00001ba0| 61 75 73 65 20 70 61 72 | 65 6e 74 68 65 73 65 73 |ause par|entheses|
|00001bb0| 20 61 72 65 20 0a 75 73 | 65 64 20 69 6e 20 46 6f | are .us|ed in Fo|
|00001bc0| 72 74 68 20 74 6f 20 65 | 6e 63 6c 6f 73 65 20 63 |rth to e|nclose c|
|00001bd0| 6f 6d 6d 65 6e 74 73 2e | 20 20 54 68 65 20 46 6f |omments.| The Fo|
|00001be0| 72 74 68 20 73 79 73 74 | 65 6d 20 77 69 6c 6c 20 |rth syst|em will |
|00001bf0| 69 67 6e 6f 72 65 20 0a | 65 76 65 72 79 74 68 69 |ignore .|everythi|
|00001c00| 6e 67 20 62 65 74 77 65 | 65 6e 20 22 28 22 20 61 |ng betwe|en "(" a|
|00001c10| 6e 64 20 74 68 65 20 6e | 65 78 74 20 22 29 22 2e |nd the n|ext ")".|
|00001c20| 20 20 54 68 65 20 73 70 | 61 63 65 20 62 65 74 77 | The sp|ace betw|
|00001c30| 65 65 6e 20 22 28 22 20 | 61 6e 64 20 0a 22 6e 31 |een "(" |and ."n1|
|00001c40| 22 20 69 73 20 6e 65 63 | 65 73 73 61 72 79 2e 20 |" is nec|essary. |
|00001c50| 20 54 68 65 20 73 70 61 | 63 65 20 62 65 74 77 65 | The spa|ce betwe|
|00001c60| 65 6e 20 22 73 75 6d 22 | 20 61 6e 64 20 22 29 22 |en "sum"| and ")"|
|00001c70| 20 69 73 20 6f 70 74 69 | 6f 6e 61 6c 20 69 6e 20 | is opti|onal in |
|00001c80| 0a 6d 6f 73 74 20 46 6f | 72 74 68 27 73 2c 20 62 |.most Fo|rth's, b|
|00001c90| 75 74 20 69 74 20 69 73 | 20 61 20 67 6f 6f 64 20 |ut it is| a good |
|00001ca0| 69 64 65 61 20 74 6f 20 | 69 6e 63 6c 75 64 65 20 |idea to |include |
|00001cb0| 69 74 20 61 6e 79 77 61 | 79 2e 20 20 0a 0a 42 79 |it anywa|y. ..By|
|00001cc0| 20 63 6f 6e 76 65 6e 74 | 69 6f 6e 2c 20 74 68 65 | convent|ion, the|
|00001cd0| 20 72 69 67 68 74 6d 6f | 73 74 20 6e 75 6d 62 65 | rightmo|st numbe|
|00001ce0| 72 20 28 6e 32 29 20 69 | 73 20 74 68 65 20 6f 6e |r (n2) i|s the on|
|00001cf0| 65 20 74 68 61 74 20 69 | 73 20 6f 6e 20 74 6f 70 |e that i|s on top|
|00001d00| 20 6f 66 20 0a 74 68 65 | 20 73 74 61 63 6b 2e 20 | of .the| stack. |
|00001d10| 20 54 68 75 73 20 28 20 | 61 20 62 20 63 20 2d 2d | Thus ( |a b c --|
|00001d20| 20 64 20 65 20 66 20 29 | 20 77 6f 75 6c 64 20 73 | d e f )| would s|
|00001d30| 69 67 6e 69 66 79 20 61 | 20 77 6f 72 64 20 77 68 |ignify a| word wh|
|00001d40| 69 63 68 20 0a 65 78 70 | 65 63 74 65 64 20 63 20 |ich .exp|ected c |
|00001d50| 6f 6e 20 74 6f 70 20 6f | 66 20 74 68 65 20 73 74 |on top o|f the st|
|00001d60| 61 63 6b 2c 20 62 20 75 | 6e 64 65 72 20 63 2c 20 |ack, b u|nder c, |
|00001d70| 61 6e 64 20 61 20 75 6e | 64 65 72 20 62 2e 20 20 |and a un|der b. |
|00001d80| 41 66 74 65 72 20 0a 65 | 78 65 63 75 74 69 6f 6e |After .e|xecution|
|00001d90| 2c 20 66 20 77 6f 75 6c | 64 20 62 65 20 6f 6e 20 |, f woul|d be on |
|00001da0| 74 6f 70 2c 20 77 69 74 | 68 20 65 20 75 6e 64 65 |top, wit|h e unde|
|00001db0| 72 20 66 2c 20 61 6e 64 | 20 64 20 75 6e 64 65 72 |r f, and| d under|
|00001dc0| 20 65 2e 20 20 0a 0a 0a | 56 61 72 69 61 62 6c 65 | e. ...|Variable|
|00001dd0| 73 2c 20 40 2c 20 21 0a | 3d 3d 3d 3d 3d 3d 3d 3d |s, @, !.|========|
|00001de0| 3d 3d 3d 3d 3d 3d 3d 0a | 0a 0a 76 61 72 69 61 62 |=======.|..variab|
|00001df0| 6c 65 20 20 6a 6f 68 6e | 20 28 20 2d 2d 20 61 64 |le john| ( -- ad|
|00001e00| 72 20 29 0a 0a 64 65 66 | 69 6e 65 73 20 61 20 76 |r )..def|ines a v|
|00001e10| 61 72 69 61 62 6c 65 20 | 63 61 6c 6c 65 64 20 6a |ariable |called j|
|00001e20| 6f 68 6e 20 61 6e 64 20 | 61 6c 6c 6f 63 61 74 65 |ohn and |allocate|
|00001e30| 73 20 6f 6e 65 20 33 32 | 2d 62 69 74 20 6d 61 63 |s one 32|-bit mac|
|00001e40| 68 69 6e 65 73 20 77 6f | 72 64 20 0a 66 6f 72 20 |hines wo|rd .for |
|00001e50| 69 74 2e 20 20 54 68 65 | 20 73 74 61 63 6b 20 64 |it. The| stack d|
|00001e60| 69 61 67 72 61 6d 20 73 | 68 6f 77 73 20 74 68 61 |iagram s|hows tha|
|00001e70| 74 20 77 68 65 6e 20 6a | 6f 68 6e 20 69 73 20 65 |t when j|ohn is e|
|00001e80| 78 65 63 75 74 65 64 2c | 20 61 6e 20 0a 61 64 64 |xecuted,| an .add|
|00001e90| 72 65 73 73 20 77 69 6c | 6c 20 62 65 20 6c 65 66 |ress wil|l be lef|
|00001ea0| 74 20 6f 6e 20 74 68 65 | 20 73 74 61 63 6b 2e 20 |t on the| stack. |
|00001eb0| 20 54 68 65 20 61 64 64 | 72 65 73 73 20 69 73 20 | The add|ress is |
|00001ec0| 74 68 65 20 61 64 64 72 | 65 73 73 20 6f 66 20 74 |the addr|ess of t|
|00001ed0| 68 65 20 0a 77 6f 72 64 | 20 74 68 61 74 20 77 61 |he .word| that wa|
|00001ee0| 73 20 61 6c 6c 6f 63 61 | 74 65 64 20 66 6f 72 20 |s alloca|ted for |
|00001ef0| 6a 6f 68 6e 2e 20 20 52 | 69 67 68 74 20 6e 6f 77 |john. R|ight now|
|00001f00| 20 77 65 20 64 6f 6e 27 | 74 20 6b 6e 6f 77 20 77 | we don'|t know w|
|00001f10| 68 61 74 20 76 61 6c 75 | 65 20 0a 69 73 20 63 6f |hat valu|e .is co|
|00001f20| 6e 74 61 69 6e 65 64 20 | 69 6e 20 74 68 65 20 76 |ntained |in the v|
|00001f30| 61 72 69 61 62 6c 65 2c | 20 73 6f 20 6c 65 74 27 |ariable,| so let'|
|00001f40| 73 20 70 75 74 20 73 6f | 6d 65 74 68 69 6e 67 20 |s put so|mething |
|00001f50| 69 6e 20 69 74 2e 20 20 | 0a 0a 31 32 33 20 6a 6f |in it. |..123 jo|
|00001f60| 68 6e 20 21 0a 0a 77 69 | 6c 6c 20 70 75 74 20 74 |hn !..wi|ll put t|
|00001f70| 68 65 20 6e 75 6d 62 65 | 72 20 31 32 33 20 69 6e |he numbe|r 123 in|
|00001f80| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 2e 20 20 | the var|iable. |
|00001f90| 21 20 2c 20 70 72 6f 6e | 6f 75 6e 63 65 64 20 27 |! , pron|ounced '|
|00001fa0| 73 74 6f 72 65 27 20 2c | 20 69 73 20 0a 74 68 65 |store' ,| is .the|
|00001fb0| 20 73 74 6f 72 65 20 6f | 70 65 72 61 74 6f 72 2e | store o|perator.|
|00001fc0| 20 20 49 74 73 20 73 74 | 61 63 6b 20 64 69 61 67 | Its st|ack diag|
|00001fd0| 72 61 6d 20 6c 6f 6f 6b | 73 20 6c 69 6b 65 20 28 |ram look|s like (|
|00001fe0| 20 76 61 6c 75 65 20 61 | 64 72 20 2d 2d 20 29 2c | value a|dr -- ),|
|00001ff0| 20 0a 6d 65 61 6e 69 6e | 67 20 74 68 61 74 20 69 | .meanin|g that i|
|00002000| 74 20 65 78 70 65 63 74 | 73 20 61 6e 20 61 64 64 |t expect|s an add|
|00002010| 72 65 73 73 20 6f 6e 20 | 74 68 65 20 74 6f 70 20 |ress on |the top |
|00002020| 6f 66 20 74 68 65 20 73 | 74 61 63 6b 20 61 6e 64 |of the s|tack and|
|00002030| 20 61 20 76 61 6c 75 65 | 20 0a 75 6e 64 65 72 6e | a value| .undern|
|00002040| 65 61 74 68 20 74 68 65 | 20 61 64 64 72 65 73 73 |eath the| address|
|00002050| 2e 20 20 54 68 65 20 76 | 61 6c 75 65 20 77 69 6c |. The v|alue wil|
|00002060| 6c 20 62 65 20 70 75 74 | 20 69 6e 20 74 68 65 20 |l be put| in the |
|00002070| 6d 61 63 68 69 6e 65 20 | 77 6f 72 64 20 61 74 20 |machine |word at |
|00002080| 0a 74 68 65 20 69 6e 64 | 69 63 61 74 65 64 20 61 |.the ind|icated a|
|00002090| 64 64 72 65 73 73 2c 20 | 61 6e 64 20 62 6f 74 68 |ddress, |and both|
|000020a0| 20 61 72 67 75 6d 65 6e | 74 73 20 77 69 6c 6c 20 | argumen|ts will |
|000020b0| 62 65 20 72 65 6d 6f 76 | 65 64 20 66 72 6f 6d 20 |be remov|ed from |
|000020c0| 74 68 65 20 0a 73 74 61 | 63 6b 2e 20 20 0a 0a 4e |the .sta|ck. ..N|
|000020d0| 6f 74 65 20 69 6e 20 74 | 68 69 73 20 65 78 61 6d |ote in t|his exam|
|000020e0| 70 6c 65 20 74 68 61 74 | 20 74 68 65 20 61 64 64 |ple that| the add|
|000020f0| 72 65 73 73 20 77 61 73 | 20 6c 65 66 74 20 62 79 |ress was| left by|
|00002100| 20 74 68 65 20 77 6f 72 | 64 20 6a 6f 68 6e 2e 20 | the wor|d john. |
|00002110| 20 49 74 20 0a 69 73 20 | 61 6e 20 69 6d 70 6f 72 | It .is |an impor|
|00002120| 74 61 6e 74 20 70 6f 69 | 6e 74 20 74 68 61 74 20 |tant poi|nt that |
|00002130| 76 61 72 69 61 62 6c 65 | 73 20 6c 65 61 76 65 20 |variable|s leave |
|00002140| 74 68 65 69 72 20 61 64 | 64 72 65 73 73 65 73 2c |their ad|dresses,|
|00002150| 20 72 61 74 68 65 72 20 | 0a 74 68 61 6e 20 74 68 | rather |.than th|
|00002160| 65 69 72 20 76 61 6c 75 | 65 73 2e 20 20 49 66 20 |eir valu|es. If |
|00002170| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 61 20 76 |the valu|e of a v|
|00002180| 61 72 69 61 62 6c 65 20 | 69 73 20 6e 65 65 64 65 |ariable |is neede|
|00002190| 64 2c 20 74 68 65 20 40 | 20 0a 28 66 65 74 63 68 |d, the @| .(fetch|
|000021a0| 29 20 6f 70 65 72 61 74 | 6f 72 20 69 73 20 75 73 |) operat|or is us|
|000021b0| 65 64 2e 20 20 0a 0a 6a | 6f 68 6e 20 40 0a 0a 77 |ed. ..j|ohn @..w|
|000021c0| 69 6c 6c 20 6c 65 61 76 | 65 20 74 68 65 20 76 61 |ill leav|e the va|
|000021d0| 6c 75 65 20 63 6f 6e 74 | 61 69 6e 65 64 20 69 6e |lue cont|ained in|
|000021e0| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 2c 20 69 | the var|iable, i|
|000021f0| 6e 20 74 68 69 73 20 63 | 61 73 65 20 31 32 33 2c |n this c|ase 123,|
|00002200| 20 6f 6e 20 0a 74 68 65 | 20 73 74 61 63 6b 2e 20 | on .the| stack. |
|00002210| 20 54 68 65 20 73 74 61 | 63 6b 20 64 69 61 67 72 | The sta|ck diagr|
|00002220| 61 6d 20 66 6f 72 20 40 | 20 69 73 20 28 20 61 64 |am for @| is ( ad|
|00002230| 72 20 2d 2d 20 76 61 6c | 75 65 20 29 2e 20 20 0a |r -- val|ue ). .|
|00002240| 0a 49 74 20 69 73 20 72 | 65 61 73 6f 6e 61 62 6c |.It is r|easonabl|
|00002250| 65 20 74 6f 20 61 73 6b | 20 77 68 79 20 69 74 20 |e to ask| why it |
|00002260| 77 6f 72 6b 73 20 74 68 | 69 73 20 77 61 79 2c 20 |works th|is way, |
|00002270| 72 61 74 68 65 72 20 74 | 68 61 6e 20 68 61 76 69 |rather t|han havi|
|00002280| 6e 67 20 61 20 0a 76 61 | 72 69 61 62 6c 65 20 72 |ng a .va|riable r|
|00002290| 65 74 75 72 6e 20 69 74 | 73 20 76 61 6c 75 65 2e |eturn it|s value.|
|000022a0| 20 20 49 6e 20 66 61 63 | 74 2c 20 61 20 73 63 68 | In fac|t, a sch|
|000022b0| 65 6d 65 20 74 6f 20 64 | 6f 20 74 68 69 73 20 77 |eme to d|o this w|
|000022c0| 61 73 20 64 69 73 63 75 | 73 73 65 64 20 0a 69 6e |as discu|ssed .in|
|000022d0| 20 74 68 65 20 46 6f 72 | 74 68 20 63 6f 6d 6d 75 | the For|th commu|
|000022e0| 6e 69 74 79 20 66 6f 72 | 20 61 77 68 69 6c 65 2c |nity for| awhile,|
|000022f0| 20 61 6e 64 20 74 68 65 | 20 66 69 6e 61 6c 20 63 | and the| final c|
|00002300| 6f 6e 73 65 6e 73 75 73 | 20 77 61 73 20 74 68 61 |onsensus| was tha|
|00002310| 74 20 0a 74 68 65 20 74 | 68 65 20 63 6f 6e 73 69 |t .the t|he consi|
|00002320| 73 74 65 6e 63 79 20 61 | 6e 64 20 72 65 67 75 6c |stency a|nd regul|
|00002330| 61 72 69 74 79 20 6f 66 | 20 74 68 65 20 40 20 61 |arity of| the @ a|
|00002340| 6e 64 20 21 20 6f 70 65 | 72 61 74 6f 72 73 20 77 |nd ! ope|rators w|
|00002350| 61 73 20 74 6f 6f 20 0a | 70 6f 77 65 72 66 75 6c |as too .|powerful|
|00002360| 20 74 6f 20 67 69 76 65 | 20 75 70 2e 20 20 46 6f | to give| up. Fo|
|00002370| 72 74 68 20 69 73 20 6e | 6f 74 20 74 68 65 20 6f |rth is n|ot the o|
|00002380| 6e 6c 79 20 6c 61 6e 67 | 75 61 67 65 20 74 6f 20 |nly lang|uage to |
|00002390| 64 6f 20 69 74 20 69 73 | 20 74 68 69 73 20 0a 77 |do it is| this .w|
|000023a0| 61 79 2e 20 20 42 4c 49 | 53 53 20 69 73 20 61 6e |ay. BLI|SS is an|
|000023b0| 6f 74 68 65 72 20 6c 61 | 6e 67 75 61 67 65 20 77 |other la|nguage w|
|000023c0| 68 69 63 68 20 72 65 71 | 75 69 72 65 73 20 61 6e |hich req|uires an|
|000023d0| 20 65 78 70 6c 69 63 69 | 74 20 6f 70 65 72 61 74 | explici|t operat|
|000023e0| 6f 72 20 74 6f 20 0a 72 | 65 74 75 72 6e 20 74 68 |or to .r|eturn th|
|000023f0| 65 20 76 61 6c 75 65 20 | 6f 66 20 61 20 76 61 72 |e value |of a var|
|00002400| 69 61 62 6c 65 2e 20 20 | 0a 0a 53 69 6d 69 6c 61 |iable. |..Simila|
|00002410| 72 20 6f 70 65 72 61 74 | 6f 72 73 2c 20 43 21 20 |r operat|ors, C! |
|00002420| 61 6e 64 20 43 40 2c 20 | 61 72 65 20 70 72 6f 76 |and C@, |are prov|
|00002430| 69 64 65 64 20 66 6f 72 | 20 73 74 6f 72 69 6e 67 |ided for| storing|
|00002440| 20 61 6e 64 20 66 65 74 | 63 68 69 6e 67 20 0a 62 | and fet|ching .b|
|00002450| 79 74 65 73 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |ytes ins|tead of |
|00002460| 33 32 2d 62 69 74 20 71 | 75 61 6e 74 69 74 69 65 |32-bit q|uantitie|
|00002470| 73 2e 20 20 54 68 65 20 | 73 74 61 63 6b 20 6f 6e |s. The |stack on|
|00002480| 6c 79 20 68 6f 6c 64 73 | 20 33 32 2d 62 69 74 20 |ly holds| 32-bit |
|00002490| 0a 71 75 61 6e 74 69 74 | 69 65 73 2c 20 73 6f 20 |.quantit|ies, so |
|000024a0| 74 68 65 20 62 79 74 65 | 73 20 61 72 65 20 73 74 |the byte|s are st|
|000024b0| 6f 72 65 64 20 69 6e 20 | 74 68 65 20 6c 65 61 73 |ored in |the leas|
|000024c0| 74 2d 73 69 67 6e 69 66 | 69 63 61 6e 74 20 70 61 |t-signif|icant pa|
|000024d0| 72 74 20 6f 66 20 0a 74 | 68 65 20 33 32 2d 62 69 |rt of .t|he 32-bi|
|000024e0| 74 20 6e 75 6d 62 65 72 | 20 6f 6e 20 74 68 65 20 |t number| on the |
|000024f0| 73 74 61 63 6b 2e 20 20 | 0a 0a 77 21 20 20 28 20 |stack. |..w! ( |
|00002500| 77 20 61 64 72 20 2d 2d | 20 29 20 20 20 20 20 20 |w adr --| ) |
|00002510| 20 20 73 74 6f 72 65 73 | 20 74 68 65 20 6c 65 61 | stores| the lea|
|00002520| 73 74 2d 73 69 67 6e 69 | 66 69 63 61 6e 74 20 31 |st-signi|ficant 1|
|00002530| 36 20 62 69 74 73 20 6f | 66 20 74 68 65 20 6e 75 |6 bits o|f the nu|
|00002540| 6d 62 65 72 0a 20 20 20 | 20 20 20 20 20 20 20 20 |mber. | |
|00002550| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6f 6e 20 | | on |
|00002560| 74 68 65 20 73 74 61 63 | 6b 20 69 6e 74 6f 20 74 |the stac|k into t|
|00002570| 68 65 20 31 36 2d 62 69 | 74 20 6d 65 6d 6f 72 79 |he 16-bi|t memory|
|00002580| 20 6c 6f 63 61 74 69 6f | 6e 20 61 74 20 61 64 64 | locatio|n at add|
|00002590| 72 0a 77 40 20 20 28 20 | 61 64 72 20 2d 2d 20 77 |r.w@ ( |adr -- w|
|000025a0| 20 29 20 20 20 20 20 20 | 20 20 66 65 74 63 68 65 | ) | fetche|
|000025b0| 73 20 74 68 65 20 31 36 | 2d 62 69 74 20 77 6f 72 |s the 16|-bit wor|
|000025c0| 64 20 61 74 20 61 64 64 | 72 2c 20 6c 65 61 76 69 |d at add|r, leavi|
|000025d0| 6e 67 20 69 74 20 6f 6e | 20 74 68 65 0a 20 20 20 |ng it on| the. |
|000025e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000025f0| 20 20 20 20 20 73 74 61 | 63 6b 2e 20 20 54 68 65 | sta|ck. The|
|00002600| 20 68 69 67 68 2d 6f 72 | 64 65 72 20 62 69 74 73 | high-or|der bits|
|00002610| 20 6f 66 20 74 68 65 20 | 73 74 61 63 6b 20 69 74 | of the |stack it|
|00002620| 65 6d 20 61 72 65 0a 20 | 20 20 20 20 20 20 20 20 |em are. | |
|00002630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7a | | z|
|00002640| 65 72 6f 65 64 2e 0a 63 | 21 20 20 28 20 62 79 74 |eroed..c|! ( byt|
|00002650| 65 20 61 64 72 20 2d 2d | 20 29 20 20 20 20 20 73 |e adr --| ) s|
|00002660| 74 6f 72 65 73 20 74 68 | 65 20 6c 65 61 73 74 2d |tores th|e least-|
|00002670| 73 69 67 6e 69 66 69 63 | 61 6e 74 20 62 79 74 65 |signific|ant byte|
|00002680| 20 6f 66 20 74 68 65 20 | 73 74 61 63 6b 0a 20 20 | of the |stack. |
|00002690| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000026a0| 20 20 20 20 20 20 69 74 | 65 6d 20 69 6e 74 6f 20 | it|em into |
|000026b0| 74 68 65 20 38 2d 62 69 | 74 20 6d 65 6d 6f 72 79 |the 8-bi|t memory|
|000026c0| 20 6c 6f 63 61 74 69 6f | 6e 20 61 74 20 61 64 72 | locatio|n at adr|
|000026d0| 20 0a 63 40 20 20 28 20 | 61 64 72 20 2d 2d 20 62 | .c@ ( |adr -- b|
|000026e0| 79 74 65 20 29 20 20 20 | 20 20 66 65 74 63 68 65 |yte ) | fetche|
|000026f0| 73 20 74 68 65 20 62 79 | 74 65 20 61 74 20 61 64 |s the by|te at ad|
|00002700| 64 72 0a 2b 21 20 20 28 | 20 6e 20 61 64 72 20 2d |dr.+! (| n adr -|
|00002710| 2d 20 29 20 20 20 20 20 | 20 20 20 61 64 64 73 20 |- ) | adds |
|00002720| 6e 20 74 6f 20 74 68 65 | 20 63 6f 6e 74 65 6e 74 |n to the| content|
|00002730| 73 20 6f 66 20 74 68 65 | 20 33 32 2d 62 69 74 20 |s of the| 32-bit |
|00002740| 77 6f 72 64 20 61 74 20 | 61 64 64 72 0a 0a 0a 43 |word at |addr...C|
|00002750| 6f 6e 73 74 61 6e 74 73 | 0a 3d 3d 3d 3d 3d 3d 3d |onstants|.=======|
|00002760| 3d 3d 0a 0a 0a 33 32 20 | 63 6f 6e 73 74 61 6e 74 |==...32 |constant|
|00002770| 20 62 75 66 6c 65 6e 0a | 0a 64 65 66 69 6e 65 73 | buflen.|.defines|
|00002780| 20 61 20 63 6f 6e 73 74 | 61 6e 74 20 77 68 6f 73 | a const|ant whos|
|00002790| 65 20 76 61 6c 75 65 20 | 69 73 20 33 32 2e 20 20 |e value |is 32. |
|000027a0| 57 68 65 6e 20 62 75 66 | 6c 65 6e 20 69 73 20 65 |When buf|len is e|
|000027b0| 78 65 63 75 74 65 64 2c | 20 69 74 20 0a 6c 65 61 |xecuted,| it .lea|
|000027c0| 76 65 73 20 69 74 73 20 | 76 61 6c 75 65 2c 20 69 |ves its |value, i|
|000027d0| 6e 20 63 6f 6e 74 72 61 | 73 74 20 74 6f 20 61 20 |n contra|st to a |
|000027e0| 76 61 72 69 61 62 6c 65 | 2c 20 77 68 69 63 68 20 |variable|, which |
|000027f0| 6c 65 61 76 65 73 20 69 | 74 73 20 61 64 64 72 65 |leaves i|ts addre|
|00002800| 73 73 2e 20 20 0a 54 68 | 65 72 65 20 69 73 20 6e |ss. .Th|ere is n|
|00002810| 6f 20 65 78 70 6c 69 63 | 69 74 20 6d 65 63 68 61 |o explic|it mecha|
|00002820| 6e 69 73 6d 20 70 72 6f | 76 69 64 65 64 20 66 6f |nism pro|vided fo|
|00002830| 72 20 63 68 61 6e 67 69 | 6e 67 20 74 68 65 20 76 |r changi|ng the v|
|00002840| 61 6c 75 65 20 6f 66 20 | 61 20 0a 63 6f 6e 73 74 |alue of |a .const|
|00002850| 61 6e 74 2e 20 20 4d 61 | 6e 79 20 46 6f 72 74 68 |ant. Ma|ny Forth|
|00002860| 20 73 79 73 74 65 6d 73 | 20 6d 61 79 20 62 65 20 | systems| may be |
|00002870| 74 72 69 63 6b 65 64 20 | 69 6e 74 6f 20 74 65 6c |tricked |into tel|
|00002880| 6c 69 6e 67 20 79 6f 75 | 20 74 68 65 20 0a 61 64 |ling you| the .ad|
|00002890| 64 72 65 73 73 20 77 68 | 65 72 65 20 74 68 65 20 |dress wh|ere the |
|000028a0| 76 61 6c 75 65 20 6f 66 | 20 61 20 63 6f 6e 73 74 |value of| a const|
|000028b0| 61 6e 74 20 69 73 20 61 | 63 74 75 61 6c 6c 79 20 |ant is a|ctually |
|000028c0| 73 74 6f 72 65 64 2c 20 | 73 6f 20 69 74 20 6d 61 |stored, |so it ma|
|000028d0| 79 20 62 65 20 0a 70 6f | 73 73 69 62 6c 65 20 74 |y be .po|ssible t|
|000028e0| 6f 20 63 68 61 6e 67 65 | 20 74 68 65 20 76 61 6c |o change| the val|
|000028f0| 75 65 2e 20 20 48 6f 77 | 65 76 65 72 2c 20 74 68 |ue. How|ever, th|
|00002900| 69 73 20 69 73 20 6e 6f | 6e 2d 73 74 61 6e 64 61 |is is no|n-standa|
|00002910| 72 64 20 61 6e 64 20 0a | 69 6d 70 6c 65 6d 65 6e |rd and .|implemen|
|00002920| 74 61 74 69 6f 6e 20 64 | 65 70 65 6e 64 65 6e 74 |tation d|ependent|
|00002930| 2e 20 20 55 73 65 20 61 | 20 76 61 72 69 61 62 6c |. Use a| variabl|
|00002940| 65 20 69 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |e if you| want to|
|00002950| 20 63 68 61 6e 67 65 20 | 74 68 65 20 0a 76 61 6c | change |the .val|
|00002960| 75 65 2e 20 20 0a 0a 62 | 75 66 6c 65 6e 20 62 75 |ue. ..b|uflen bu|
|00002970| 66 6c 65 6e 20 2b 20 2e | 0a 0a 72 65 73 75 6c 74 |flen + .|..result|
|00002980| 73 20 69 6e 20 0a 0a 36 | 34 0a 0a 62 75 66 6c 65 |s in ..6|4..bufle|
|00002990| 6e 20 6a 6f 68 6e 20 40 | 20 2b 20 2e 0a 0a 72 65 |n john @| + ...re|
|000029a0| 73 75 6c 74 73 20 69 6e | 20 0a 0a 31 35 35 0a 0a |sults in| ..155..|
|000029b0| 61 73 73 75 6d 69 6e 67 | 20 74 68 61 74 20 6a 6f |assuming| that jo|
|000029c0| 68 6e 20 77 61 73 20 64 | 65 66 69 6e 65 64 20 61 |hn was d|efined a|
|000029d0| 6e 64 20 69 6e 69 74 69 | 61 6c 69 73 65 64 20 61 |nd initi|alised a|
|000029e0| 73 20 62 65 66 6f 72 65 | 20 74 6f 20 31 32 33 2e |s before| to 123.|
|000029f0| 20 20 79 6f 75 20 0a 73 | 68 6f 75 6c 64 20 6d 61 | you .s|hould ma|
|00002a00| 6b 65 20 73 75 72 65 20 | 79 6f 75 20 75 6e 64 65 |ke sure |you unde|
|00002a10| 72 73 74 61 6e 64 20 77 | 68 79 20 74 68 65 20 40 |rstand w|hy the @|
|00002a20| 20 69 73 20 6e 65 65 64 | 65 64 20 61 66 74 65 72 | is need|ed after|
|00002a30| 20 6a 6f 68 6e 20 62 75 | 74 20 6e 6f 74 20 0a 61 | john bu|t not .a|
|00002a40| 66 74 65 72 20 62 75 66 | 6c 65 6e 2e 20 20 0a 0a |fter buf|len. ..|
|00002a50| 54 68 65 20 73 74 61 63 | 6b 20 64 69 61 67 72 61 |The stac|k diagra|
|00002a60| 6d 20 66 6f 72 20 61 20 | 63 6f 6e 73 74 61 6e 74 |m for a |constant|
|00002a70| 20 69 73 20 28 20 2d 2d | 20 76 61 6c 75 65 20 29 | is ( --| value )|
|00002a80| 2e 20 20 52 65 6d 65 6d | 62 65 72 20 74 68 61 74 |. Remem|ber that|
|00002a90| 20 74 68 69 73 20 0a 69 | 73 20 77 68 61 74 20 68 | this .i|s what h|
|00002aa0| 61 70 70 65 6e 73 20 74 | 6f 20 74 68 65 20 73 74 |appens t|o the st|
|00002ab0| 61 63 6b 20 77 68 65 6e | 20 74 68 65 20 63 6f 6e |ack when| the con|
|00002ac0| 73 74 61 6e 74 20 69 73 | 20 65 78 65 63 75 74 65 |stant is| execute|
|00002ad0| 64 2c 20 6e 6f 74 20 77 | 68 65 6e 20 0a 69 74 20 |d, not w|hen .it |
|00002ae0| 69 73 20 64 65 66 69 6e | 65 64 2e 20 20 0a 0a 4d |is defin|ed. ..M|
|00002af0| 6f 72 65 20 67 65 6e 65 | 72 61 6c 6c 79 2c 20 74 |ore gene|rally, t|
|00002b00| 68 65 20 77 6f 72 64 20 | 43 4f 4e 53 54 41 4e 54 |he word |CONSTANT|
|00002b10| 20 6e 65 65 64 20 6e 6f | 74 20 62 65 20 65 78 70 | need no|t be exp|
|00002b20| 6c 69 63 69 74 6c 79 20 | 70 72 65 63 65 64 65 64 |licitly |preceded|
|00002b30| 20 62 79 20 61 20 0a 6e | 75 6d 62 65 72 2e 20 20 | by a .n|umber. |
|00002b40| 43 4f 4e 53 54 41 4e 54 | 20 74 61 6b 65 73 20 74 |CONSTANT| takes t|
|00002b50| 68 65 20 69 6e 69 74 69 | 61 6c 20 76 61 6c 75 65 |he initi|al value|
|00002b60| 20 6f 66 66 20 6f 66 20 | 74 68 65 20 73 74 61 63 | off of |the stac|
|00002b70| 6b 2e 20 20 54 68 65 20 | 73 74 61 63 6b 20 0a 64 |k. The |stack .d|
|00002b80| 69 61 67 72 61 6d 20 69 | 73 20 0a 0a 63 6f 6e 73 |iagram i|s ..cons|
|00002b90| 74 61 6e 74 20 20 5c 20 | 6e 61 6d 65 20 20 28 20 |tant \ |name ( |
|00002ba0| 69 6e 69 74 69 61 6c 5f | 76 61 6c 75 65 20 2d 2d |initial_|value --|
|00002bb0| 20 29 0a 0a 22 5c 20 6e | 61 6d 65 22 20 6d 65 61 | ).."\ n|ame" mea|
|00002bc0| 6e 73 20 74 68 61 74 20 | 77 68 65 6e 20 74 68 65 |ns that |when the|
|00002bd0| 20 64 65 66 69 6e 69 6e | 67 20 77 6f 72 64 20 63 | definin|g word c|
|00002be0| 6f 6e 73 74 61 6e 74 20 | 65 78 65 63 75 74 65 73 |onstant |executes|
|00002bf0| 2c 20 69 74 20 74 61 6b | 65 73 20 0a 61 20 6e 61 |, it tak|es .a na|
|00002c00| 6d 65 20 28 20 61 20 73 | 65 71 75 65 6e 63 65 20 |me ( a s|equence |
|00002c10| 6f 66 20 6e 6f 6e 2d 62 | 6c 61 6e 6b 20 63 68 61 |of non-b|lank cha|
|00002c20| 72 61 63 74 65 72 73 20 | 29 20 6f 75 74 20 6f 66 |racters |) out of|
|00002c30| 20 74 68 65 20 69 6e 70 | 75 74 20 73 74 72 65 61 | the inp|ut strea|
|00002c40| 6d 20 0a 61 6e 64 20 75 | 73 65 73 20 74 68 61 74 |m .and u|ses that|
|00002c50| 20 6e 61 6d 65 20 66 6f | 72 20 73 6f 6d 65 74 68 | name fo|r someth|
|00002c60| 69 6e 67 2e 20 20 49 6e | 20 74 68 69 73 20 63 61 |ing. In| this ca|
|00002c70| 73 65 2c 20 74 68 65 20 | 6e 61 6d 65 20 69 73 20 |se, the |name is |
|00002c80| 75 73 65 64 20 61 73 20 | 0a 74 68 65 20 6e 61 6d |used as |.the nam|
|00002c90| 65 20 6f 66 20 74 68 65 | 20 6e 65 77 20 63 6f 6e |e of the| new con|
|00002ca0| 73 74 61 6e 74 2e 20 20 | 4e 6f 74 69 63 65 20 74 |stant. |Notice t|
|00002cb0| 68 61 74 20 64 69 73 74 | 69 6e 63 74 69 6f 6e 20 |hat dist|inction |
|00002cc0| 62 65 74 77 65 65 6e 20 | 0a 61 72 67 75 6d 65 6e |between |.argumen|
|00002cd0| 74 73 20 74 68 61 74 20 | 61 72 65 20 74 61 6b 65 |ts that |are take|
|00002ce0| 6e 20 66 72 6f 6d 20 74 | 68 65 20 73 74 61 63 6b |n from t|he stack|
|00002cf0| 20 61 6e 64 20 6e 61 6d | 65 73 20 74 68 61 74 20 | and nam|es that |
|00002d00| 61 72 65 20 74 61 6b 65 | 6e 20 66 72 6f 6d 20 0a |are take|n from .|
|00002d10| 74 68 65 20 69 6e 70 75 | 74 20 73 74 72 65 61 6d |the inpu|t stream|
|00002d20| 20 28 20 74 68 65 20 69 | 6e 70 75 74 20 73 74 72 | ( the i|nput str|
|00002d30| 65 61 6d 20 69 73 20 77 | 68 61 74 20 79 6f 75 20 |eam is w|hat you |
|00002d40| 74 79 70 65 20 61 74 20 | 74 68 65 20 74 65 72 6d |type at |the term|
|00002d50| 69 6e 61 6c 20 0a 29 2e | 20 20 0a 0a 53 69 6e 63 |inal .).| ..Sinc|
|00002d60| 65 20 74 79 70 69 6e 67 | 20 61 20 6e 75 6d 62 65 |e typing| a numbe|
|00002d70| 72 20 70 75 74 73 20 74 | 68 61 74 20 6e 75 6d 62 |r puts t|hat numb|
|00002d80| 65 72 20 6f 6e 20 74 68 | 65 20 73 74 61 63 6b 2c |er on th|e stack,|
|00002d90| 20 6f 75 72 20 65 78 61 | 6d 70 6c 65 20 77 6f 72 | our exa|mple wor|
|00002da0| 6b 73 20 0a 66 69 6e 65 | 2e 20 20 49 74 20 69 73 |ks .fine|. It is|
|00002db0| 20 61 6c 73 6f 20 70 6f | 73 73 69 62 6c 65 20 74 | also po|ssible t|
|00002dc0| 6f 20 75 73 65 20 46 6f | 72 74 68 20 74 6f 20 63 |o use Fo|rth to c|
|00002dd0| 61 6c 63 75 6c 61 74 65 | 20 74 68 65 20 76 61 6c |alculate| the val|
|00002de0| 75 65 20 6f 66 20 74 68 | 65 20 0a 63 6f 6e 73 74 |ue of th|e .const|
|00002df0| 61 6e 74 2c 20 61 73 20 | 69 6e 20 0a 0a 62 75 66 |ant, as |in ..buf|
|00002e00| 6c 65 6e 20 31 30 20 2a | 20 63 6f 6e 73 74 61 6e |len 10 *| constan|
|00002e10| 74 20 62 69 67 62 75 66 | 73 69 7a 65 0a 0a 77 68 |t bigbuf|size..wh|
|00002e20| 69 63 68 20 64 65 66 69 | 6e 65 73 20 61 20 63 6f |ich defi|nes a co|
|00002e30| 6e 73 74 61 6e 74 20 77 | 68 6f 73 65 20 76 61 6c |nstant w|hose val|
|00002e40| 75 65 20 69 73 20 31 30 | 20 74 69 6d 65 73 20 62 |ue is 10| times b|
|00002e50| 75 66 6c 65 6e 2c 20 6f | 72 20 33 32 30 2e 20 20 |uflen, o|r 320. |
|00002e60| 54 68 69 73 20 0a 69 73 | 20 63 6f 6d 70 6c 65 74 |This .is| complet|
|00002e70| 65 6c 79 20 67 65 6e 65 | 72 61 6c 3b 20 69 66 20 |ely gene|ral; if |
|00002e80| 79 6f 75 20 63 61 6e 20 | 67 65 74 20 61 20 6e 75 |you can |get a nu|
|00002e90| 6d 62 65 72 20 6f 6e 20 | 74 68 65 20 73 74 61 63 |mber on |the stac|
|00002ea0| 6b 20 62 79 20 61 6e 79 | 20 0a 6d 65 61 6e 73 20 |k by any| .means |
|00002eb0| 77 68 61 74 73 6f 65 76 | 65 72 2c 20 79 6f 75 20 |whatsoev|er, you |
|00002ec0| 63 61 6e 20 64 65 66 69 | 6e 65 20 61 20 63 6f 6e |can defi|ne a con|
|00002ed0| 73 74 61 6e 74 20 77 68 | 69 63 68 20 72 65 74 75 |stant wh|ich retu|
|00002ee0| 72 6e 73 20 74 68 61 74 | 20 76 61 6c 75 65 2e 20 |rns that| value. |
|00002ef0| 20 0a 0a 0a 53 74 61 63 | 6b 20 4d 61 6e 69 70 75 | ...Stac|k Manipu|
|00002f00| 6c 61 74 69 6f 6e 0a 3d | 3d 3d 3d 3d 3d 3d 3d 3d |lation.=|========|
|00002f10| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 0a 0a 54 68 65 20 66 |========|=..The f|
|00002f20| 6f 6c 6c 6f 77 69 6e 67 | 20 77 6f 72 64 73 20 72 |ollowing| words r|
|00002f30| 65 61 72 72 61 6e 67 65 | 20 6e 75 6d 62 65 72 73 |earrange| numbers|
|00002f40| 20 6f 6e 20 74 68 65 20 | 73 74 61 63 6b 2e 20 20 | on the |stack. |
|00002f50| 0a 0a 64 75 70 20 20 28 | 20 6e 20 2d 2d 20 6e 20 |..dup (| n -- n |
|00002f60| 6e 20 29 20 20 20 64 75 | 70 6c 69 63 61 74 65 73 |n ) du|plicates|
|00002f70| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 6e 20 74 | the num|ber on t|
|00002f80| 6f 70 20 6f 66 20 74 68 | 65 20 73 74 61 63 6b 2e |op of th|e stack.|
|00002f90| 20 20 54 68 69 73 20 69 | 73 20 61 0a 20 20 20 20 | This i|s a. |
|00002fa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002fb0| 72 65 61 6c 20 77 6f 72 | 6b 68 6f 72 73 65 20 2d |real wor|khorse -|
|00002fc0| 20 64 75 70 20 69 73 20 | 75 73 65 64 20 61 20 6c | dup is |used a l|
|00002fd0| 6f 74 20 77 68 65 6e 20 | 79 6f 75 20 77 61 6e 74 |ot when |you want|
|00002fe0| 20 74 6f 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | to. | |
|00002ff0| 20 20 20 20 20 20 20 20 | 6d 61 6b 65 20 61 20 63 | |make a c|
|00003000| 6f 70 79 20 62 65 63 61 | 75 73 65 20 79 6f 75 20 |opy beca|use you |
|00003010| 77 61 6e 74 20 74 6f 20 | 72 65 6d 65 6d 62 65 72 |want to |remember|
|00003020| 20 61 20 6e 75 6d 62 65 | 72 20 62 75 74 0a 20 20 | a numbe|r but. |
|00003030| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003040| 20 20 74 68 65 20 77 6f | 72 64 20 79 6f 75 20 77 | the wo|rd you w|
|00003050| 61 6e 74 20 74 6f 20 75 | 73 65 20 6e 65 78 74 20 |ant to u|se next |
|00003060| 77 69 6c 6c 20 22 65 61 | 74 22 20 69 74 2e 0a 64 |will "ea|t" it..d|
|00003070| 72 6f 70 20 20 28 20 6e | 20 2d 2d 20 29 20 20 20 |rop ( n| -- ) |
|00003080| 20 20 20 64 69 73 63 61 | 72 64 73 20 74 68 65 20 | disca|rds the |
|00003090| 6e 75 6d 62 65 72 20 6f | 6e 20 74 6f 70 20 6f 66 |number o|n top of|
|000030a0| 20 74 68 65 20 73 74 61 | 63 6b 2e 0a 73 77 61 70 | the sta|ck..swap|
|000030b0| 20 20 28 20 6e 31 20 6e | 32 20 2d 2d 20 6e 32 20 | ( n1 n|2 -- n2 |
|000030c0| 6e 31 20 29 20 20 20 20 | 65 78 63 68 61 6e 67 65 |n1 ) |exchange|
|000030d0| 73 20 74 68 65 20 70 6f | 73 69 74 69 6f 6e 73 20 |s the po|sitions |
|000030e0| 6f 66 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 6e |of the n|umber on|
|000030f0| 20 74 6f 70 0a 20 20 20 | 20 20 20 20 20 20 20 20 | top. | |
|00003100| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003110| 20 6f 66 20 74 68 65 20 | 73 74 61 63 6b 20 61 6e | of the |stack an|
|00003120| 64 20 74 68 65 20 6e 75 | 6d 62 65 72 20 75 6e 64 |d the nu|mber und|
|00003130| 65 72 6e 65 61 74 68 20 | 69 74 2e 20 20 0a 20 20 |erneath |it. . |
|00003140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003150| 20 20 20 20 20 20 20 20 | 20 20 53 75 70 70 6f 73 | | Suppos|
|00003160| 65 20 79 6f 75 20 68 61 | 64 20 33 20 34 20 6f 6e |e you ha|d 3 4 on|
|00003170| 20 74 68 65 20 73 74 61 | 63 6b 20 61 6e 64 20 79 | the sta|ck and y|
|00003180| 6f 75 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |ou. | |
|00003190| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 77 | | w|
|000031a0| 61 6e 74 65 64 20 74 6f | 20 63 6f 6d 70 75 74 65 |anted to| compute|
|000031b0| 20 34 2d 33 2e 20 20 59 | 6f 75 20 63 6f 75 6c 64 | 4-3. Y|ou could|
|000031c0| 20 64 6f 20 53 57 41 50 | 20 2d 0a 20 20 20 20 20 | do SWAP| -. |
|000031d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000031e0| 20 20 20 20 20 20 20 61 | 6e 64 20 79 6f 75 20 77 | a|nd you w|
|000031f0| 6f 75 6c 64 20 67 65 74 | 20 77 68 61 74 20 79 6f |ould get| what yo|
|00003200| 75 20 77 61 6e 74 65 64 | 2e 0a 6f 76 65 72 20 28 |u wanted|..over (|
|00003210| 20 6e 31 20 6e 32 20 2d | 2d 20 6e 31 20 6e 32 20 | n1 n2 -|- n1 n2 |
|00003220| 6e 31 20 29 20 20 63 6f | 70 69 65 73 20 74 68 65 |n1 ) co|pies the|
|00003230| 20 6e 75 6d 62 65 72 20 | 77 68 69 63 68 20 69 73 | number |which is|
|00003240| 20 64 69 72 65 63 74 6c | 79 0a 20 20 20 20 20 20 | directl|y. |
|00003250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003260| 20 20 20 20 20 20 75 6e | 64 65 72 6e 65 61 74 68 | un|derneath|
|00003270| 20 74 68 65 20 74 6f 70 | 20 6f 66 20 74 68 65 20 | the top| of the |
|00003280| 73 74 61 63 6b 20 73 6f | 20 74 68 61 74 20 61 20 |stack so| that a |
|00003290| 63 6f 70 79 0a 20 20 20 | 20 20 20 20 20 20 20 20 |copy. | |
|000032a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000032b0| 20 6f 66 20 69 74 20 6f | 6e 20 74 6f 70 2e 0a 72 | of it o|n top..r|
|000032c0| 6f 74 20 28 20 6e 31 20 | 6e 32 20 6e 33 20 2d 2d |ot ( n1 |n2 n3 --|
|000032d0| 20 6e 32 20 6e 33 20 6e | 31 20 29 20 70 75 6c 6c | n2 n3 n|1 ) pull|
|000032e0| 73 20 74 68 65 20 74 68 | 69 72 64 20 73 74 61 63 |s the th|ird stac|
|000032f0| 6b 20 65 6c 65 6d 65 6e | 74 20 74 6f 20 74 68 65 |k elemen|t to the|
|00003300| 20 74 6f 70 0a 20 20 20 | 20 20 20 20 20 20 20 20 | top. | |
|00003310| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003320| 20 61 6e 64 20 6d 6f 76 | 65 73 20 74 68 65 20 74 | and mov|es the t|
|00003330| 77 6f 20 77 68 69 63 68 | 20 77 65 72 65 20 61 62 |wo which| were ab|
|00003340| 6f 76 65 20 69 74 0a 20 | 20 20 20 20 20 20 20 20 |ove it. | |
|00003350| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003360| 20 20 20 64 6f 77 6e 20 | 74 6f 20 66 69 6c 6c 20 | down |to fill |
|00003370| 69 74 73 20 76 61 63 61 | 6e 63 79 2e 0a 70 69 63 |its vaca|ncy..pic|
|00003380| 6b 20 20 28 20 20 6e 70 | 20 6e 70 2d 31 20 6e 70 |k ( np| np-1 np|
|00003390| 2d 32 20 2e 2e 2e 20 6e | 30 20 70 20 2d 2d 20 6e |-2 ... n|0 p -- n|
|000033a0| 70 20 6e 70 2d 31 20 6e | 70 2d 32 20 6e 70 2d 32 |p np-1 n|p-2 np-2|
|000033b0| 20 2e 2e 2e 20 6e 30 20 | 6e 70 20 29 0a 20 20 20 | ... n0 |np ). |
|000033c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000033d0| 20 20 20 63 6f 70 69 65 | 73 20 74 68 65 20 70 2d | copie|s the p-|
|000033e0| 74 68 20 73 74 61 63 6b | 20 65 6c 65 6d 65 6e 74 |th stack| element|
|000033f0| 20 74 6f 20 74 68 65 20 | 74 6f 70 20 6f 66 20 74 | to the |top of t|
|00003400| 68 65 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |he. | |
|00003410| 20 20 20 20 20 20 20 20 | 20 73 74 61 63 6b 3b 20 | | stack; |
|00003420| 30 20 70 69 63 6b 20 69 | 73 20 65 71 75 69 76 61 |0 pick i|s equiva|
|00003430| 6c 65 6e 74 20 74 6f 20 | 64 75 70 0a 20 20 20 20 |lent to |dup. |
|00003440| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003450| 20 20 20 20 20 20 20 20 | 20 31 20 70 69 63 6b 20 | | 1 pick |
|00003460| 69 73 20 65 71 75 69 76 | 61 6c 65 6e 74 20 74 6f |is equiv|alent to|
|00003470| 20 6f 76 65 72 0a 72 6f | 6c 6c 20 20 28 20 6e 70 | over.ro|ll ( np|
|00003480| 20 6e 70 2d 31 20 6e 70 | 2d 32 20 2e 2e 2e 20 6e | np-1 np|-2 ... n|
|00003490| 30 20 70 20 2d 2d 20 6e | 70 2d 31 20 6e 70 2d 32 |0 p -- n|p-1 np-2|
|000034a0| 20 2e 2e 2e 20 6e 30 20 | 6e 70 20 29 0a 20 20 20 | ... n0 |np ). |
|000034b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000034c0| 20 20 20 6d 6f 76 65 73 | 20 74 68 65 20 70 2d 74 | moves| the p-t|
|000034d0| 68 20 73 74 61 63 6b 20 | 65 6c 65 6d 65 6e 74 20 |h stack |element |
|000034e0| 74 6f 20 74 68 65 20 74 | 6f 70 20 61 6e 64 20 6d |to the t|op and m|
|000034f0| 6f 76 65 73 0a 20 20 20 | 20 20 20 20 20 20 20 20 |oves. | |
|00003500| 20 20 20 20 20 20 20 20 | 20 20 20 74 68 65 20 6f | | the o|
|00003510| 74 68 65 72 73 20 64 6f | 77 6e 20 74 6f 20 66 69 |thers do|wn to fi|
|00003520| 6c 6c 20 74 68 65 20 76 | 61 63 61 6e 63 79 2e 20 |ll the v|acancy. |
|00003530| 20 33 20 72 6f 6c 6c 20 | 69 73 0a 20 20 20 20 20 | 3 roll |is. |
|00003540| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003550| 20 65 71 75 69 76 61 6c | 65 6e 74 20 74 6f 20 72 | equival|ent to r|
|00003560| 6f 74 0a 64 65 70 74 68 | 20 20 28 20 2d 2d 20 6e |ot.depth| ( -- n|
|00003570| 20 29 20 20 20 20 20 20 | 20 6c 65 61 76 65 73 20 | ) | leaves |
|00003580| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 69 74 |the numb|er of it|
|00003590| 65 6d 73 20 74 68 61 74 | 20 77 65 72 65 20 6f 6e |ems that| were on|
|000035a0| 20 74 68 65 20 73 74 61 | 63 6b 0a 20 20 20 20 20 | the sta|ck. |
|000035b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000035c0| 20 62 65 66 6f 72 65 20 | 64 65 70 74 68 20 65 78 | before |depth ex|
|000035d0| 65 63 75 74 65 64 2e 20 | 20 54 68 65 20 6e 75 6d |ecuted. | The num|
|000035e0| 62 65 72 20 74 68 61 74 | 20 64 65 70 74 68 20 6c |ber that| depth l|
|000035f0| 65 61 76 65 73 0a 20 20 | 20 20 20 20 20 20 20 20 |eaves. | |
|00003600| 20 20 20 20 20 20 20 20 | 20 20 20 20 6f 6e 20 74 | | on t|
|00003610| 68 65 20 73 74 61 63 6b | 20 69 73 20 6e 6f 74 20 |he stack| is not |
|00003620| 69 6e 63 6c 75 64 65 64 | 20 69 6e 20 74 68 65 20 |included| in the |
|00003630| 63 6f 75 6e 74 2e 0a 0a | 0a 43 6f 6e 64 69 74 69 |count...|.Conditi|
|00003640| 6f 6e 61 6c 73 0a 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |onals.==|========|
|00003650| 3d 3d 0a 0a 4f 66 20 63 | 6f 75 72 73 65 20 46 6f |==..Of c|ourse Fo|
|00003660| 72 74 68 20 6c 65 74 73 | 20 79 6f 75 20 6d 61 6b |rth lets| you mak|
|00003670| 65 20 74 65 73 74 73 20 | 61 6e 64 20 64 6f 20 64 |e tests |and do d|
|00003680| 69 66 66 65 72 65 6e 74 | 20 74 68 69 6e 67 73 20 |ifferent| things |
|00003690| 62 61 73 65 64 20 6f 6e | 20 0a 74 68 65 20 72 65 |based on| .the re|
|000036a0| 73 75 6c 74 73 20 6f 66 | 20 74 68 6f 73 65 20 74 |sults of| those t|
|000036b0| 65 73 74 73 2e 20 20 0a | 0a 48 65 72 65 20 61 72 |ests. .|.Here ar|
|000036c0| 65 20 73 6f 6d 65 20 77 | 6f 72 64 73 20 77 68 69 |e some w|ords whi|
|000036d0| 63 68 20 61 72 65 20 75 | 73 65 66 75 6c 20 66 6f |ch are u|seful fo|
|000036e0| 72 20 63 6f 6d 70 61 72 | 69 73 6f 6e 73 2e 20 20 |r compar|isons. |
|000036f0| 0a 0a 3c 20 20 20 20 20 | 28 20 6e 31 20 6e 32 20 |..< |( n1 n2 |
|00003700| 2d 2d 20 66 6c 61 67 20 | 29 20 20 20 46 6c 61 67 |-- flag |) Flag|
|00003710| 20 69 73 20 74 72 75 65 | 20 69 66 20 6e 31 20 3c | is true| if n1 <|
|00003720| 20 6e 32 0a 3d 20 20 20 | 20 20 28 20 6e 31 20 6e | n2.= | ( n1 n|
|00003730| 32 20 2d 2d 20 66 6c 61 | 67 20 29 20 20 20 46 6c |2 -- fla|g ) Fl|
|00003740| 61 67 20 69 73 20 74 72 | 75 65 20 69 66 20 6e 31 |ag is tr|ue if n1|
|00003750| 20 3d 20 6e 32 0a 3e 20 | 20 20 20 20 28 20 6e 31 | = n2.> | ( n1|
|00003760| 20 6e 32 20 2d 2d 20 66 | 6c 61 67 20 29 20 20 20 | n2 -- f|lag ) |
|00003770| 46 6c 61 67 20 69 73 20 | 74 72 75 65 20 69 66 20 |Flag is |true if |
|00003780| 6e 31 20 3e 20 6e 32 0a | 30 3c 20 20 20 20 28 20 |n1 > n2.|0< ( |
|00003790| 6e 31 20 2d 2d 20 66 6c | 61 67 20 29 20 20 20 20 |n1 -- fl|ag ) |
|000037a0| 20 20 46 6c 61 67 20 69 | 73 20 74 72 75 65 20 69 | Flag i|s true i|
|000037b0| 66 20 6e 31 20 3c 20 30 | 0a 30 3d 20 20 20 20 28 |f n1 < 0|.0= (|
|000037c0| 20 6e 31 20 2d 2d 20 66 | 6c 61 67 20 29 20 20 20 | n1 -- f|lag ) |
|000037d0| 20 20 20 46 6c 61 67 20 | 69 73 20 74 72 75 65 20 | Flag |is true |
|000037e0| 69 66 20 6e 31 20 3d 20 | 30 0a 3c 3e 20 20 20 20 |if n1 = |0.<> |
|000037f0| 28 20 6e 31 20 6e 32 20 | 2d 2d 20 20 66 6c 61 67 |( n1 n2 |-- flag|
|00003800| 20 29 20 20 46 6c 61 67 | 20 69 73 20 74 72 75 65 | ) Flag| is true|
|00003810| 20 69 66 20 6e 31 20 6e | 6f 74 20 65 71 75 61 6c | if n1 n|ot equal|
|00003820| 20 74 6f 20 6e 32 0a 30 | 3e 20 20 20 20 28 20 6e | to n2.0|> ( n|
|00003830| 31 20 2d 2d 20 66 6c 61 | 67 20 29 20 20 20 20 20 |1 -- fla|g ) |
|00003840| 20 46 6c 61 67 20 69 73 | 20 74 72 75 65 20 69 66 | Flag is| true if|
|00003850| 20 6e 31 20 3e 20 30 0a | 75 3c 20 20 20 20 28 20 | n1 > 0.|u< ( |
|00003860| 75 6e 31 20 75 6e 32 20 | 2d 2d 20 66 6c 61 67 29 |un1 un2 |-- flag)|
|00003870| 20 20 22 3c 22 20 66 6f | 72 20 75 6e 73 69 67 6e | "<" fo|r unsign|
|00003880| 65 64 20 69 6e 74 65 67 | 65 72 73 2c 20 73 75 63 |ed integ|ers, suc|
|00003890| 68 20 61 73 20 61 64 64 | 72 65 73 73 65 73 0a 3f |h as add|resses.?|
|000038a0| 64 75 70 20 20 28 6e 2d | 2d 20 5b 6e 5d 20 6e 20 |dup (n-|- [n] n |
|000038b0| 29 20 20 20 20 20 20 20 | 20 64 75 70 6c 69 63 61 |) | duplica|
|000038c0| 74 65 20 74 68 65 20 74 | 6f 70 20 6f 66 20 74 68 |te the t|op of th|
|000038d0| 65 20 73 74 61 63 6b 20 | 6f 6e 6c 79 20 69 66 20 |e stack |only if |
|000038e0| 69 74 20 69 73 20 6e 6f | 74 0a 20 20 20 20 20 20 |it is no|t. |
|000038f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003900| 20 20 20 20 7a 65 72 6f | 0a 0a 54 68 65 20 62 72 | zero|..The br|
|00003910| 61 63 6b 65 74 73 20 6d | 65 61 6e 20 74 68 61 74 |ackets m|ean that|
|00003920| 20 74 68 65 20 6e 75 6d | 62 65 72 20 69 6e 20 62 | the num|ber in b|
|00003930| 72 61 63 6b 65 74 73 20 | 69 73 20 70 72 65 73 65 |rackets |is prese|
|00003940| 6e 74 20 6f 6e 6c 79 20 | 69 66 20 74 68 65 20 0a |nt only |if the .|
|00003950| 6e 75 6d 62 65 72 20 6f | 6e 20 74 6f 70 20 6f 66 |number o|n top of|
|00003960| 20 69 74 20 69 73 20 6e | 6f 6e 7a 65 72 6f 2e 20 | it is n|onzero. |
|00003970| 20 54 68 69 73 20 63 6f | 6e 76 65 6e 74 69 6f 6e | This co|nvention|
|00003980| 20 69 73 20 75 73 65 66 | 75 6c 20 62 65 63 61 75 | is usef|ul becau|
|00003990| 73 65 20 0a 73 6f 6d 65 | 20 77 6f 72 64 73 20 6c |se .some| words l|
|000039a0| 65 61 76 65 20 61 20 66 | 6c 61 67 20 6f 6e 20 74 |eave a f|lag on t|
|000039b0| 6f 70 20 6f 66 20 74 68 | 65 20 73 74 61 63 6b 20 |op of th|e stack |
|000039c0| 74 6f 20 69 6e 64 69 63 | 61 74 65 20 77 68 65 74 |to indic|ate whet|
|000039d0| 68 65 72 20 6f 72 20 6e | 6f 74 20 0a 61 20 70 61 |her or n|ot .a pa|
|000039e0| 72 74 69 63 75 6c 61 72 | 20 6f 70 65 72 61 74 69 |rticular| operati|
|000039f0| 6f 6e 20 73 75 63 63 65 | 65 64 65 64 2e 20 20 49 |on succe|eded. I|
|00003a00| 66 20 69 74 20 64 69 64 | 20 73 75 63 63 65 65 64 |f it did| succeed|
|00003a10| 2c 20 74 68 65 20 66 6c | 61 67 20 69 73 20 74 72 |, the fl|ag is tr|
|00003a20| 75 65 20 0a 61 6e 64 20 | 74 68 65 20 77 6f 72 64 |ue .and |the word|
|00003a30| 20 68 61 73 20 6c 65 66 | 74 20 73 6f 6d 65 20 72 | has lef|t some r|
|00003a40| 65 73 75 6c 74 73 20 6f | 6e 20 74 68 65 20 73 74 |esults o|n the st|
|00003a50| 61 63 6b 20 75 6e 64 65 | 72 6e 65 61 74 68 20 74 |ack unde|rneath t|
|00003a60| 68 65 20 66 6c 61 67 2e | 20 20 0a 49 66 20 74 68 |he flag.| .If th|
|00003a70| 65 20 6f 70 65 72 61 74 | 69 6f 6e 20 66 61 69 6c |e operat|ion fail|
|00003a80| 65 64 2c 20 74 68 65 20 | 66 6c 61 67 20 69 73 20 |ed, the |flag is |
|00003a90| 66 61 6c 73 65 20 28 7a | 65 72 6f 29 20 61 6e 64 |false (z|ero) and|
|00003aa0| 20 74 68 65 20 72 65 73 | 75 6c 74 73 20 77 65 72 | the res|ults wer|
|00003ab0| 65 20 0a 6e 6f 74 20 70 | 75 74 20 6f 6e 20 74 68 |e .not p|ut on th|
|00003ac0| 65 20 73 74 61 63 6b 2e | 20 20 0a 0a 54 68 65 20 |e stack.| ..The |
|00003ad0| 62 61 73 69 63 20 63 6f | 6e 64 69 74 69 6f 6e 61 |basic co|nditiona|
|00003ae0| 6c 20 69 6e 20 46 6f 72 | 74 68 20 69 73 20 49 46 |l in For|th is IF|
|00003af0| 20 2e 20 20 49 74 27 73 | 20 73 74 61 63 6b 20 64 | . It's| stack d|
|00003b00| 69 61 67 72 61 6d 20 69 | 73 20 28 20 6e 20 2d 2d |iagram i|s ( n --|
|00003b10| 20 0a 29 2c 20 61 6e 64 | 20 69 74 20 69 73 20 75 | .), and| it is u|
|00003b20| 73 65 64 20 6c 69 6b 65 | 3a 20 0a 0a 69 66 20 20 |sed like|: ..if |
|00003b30| 73 74 75 66 66 5f 74 6f | 5f 64 6f 5f 69 66 5f 6e |stuff_to|_do_if_n|
|00003b40| 5f 77 61 73 5f 6e 6f 74 | 5f 30 20 20 65 6c 73 65 |_was_not|_0 else|
|00003b50| 20 20 73 74 75 66 66 5f | 74 6f 5f 64 6f 5f 69 66 | stuff_|to_do_if|
|00003b60| 5f 6e 5f 77 61 73 5f 30 | 20 20 74 68 65 6e 0a 0a |_n_was_0| then..|
|00003b70| 54 68 65 20 45 4c 53 45 | 20 70 61 72 74 20 69 73 |The ELSE| part is|
|00003b80| 20 6f 70 74 69 6f 6e 61 | 6c 2e 20 20 54 68 65 20 | optiona|l. The |
|00003b90| 75 73 65 20 6f 66 20 74 | 68 65 20 45 6e 67 6c 69 |use of t|he Engli|
|00003ba0| 73 68 20 77 6f 72 64 20 | 22 74 68 65 6e 22 20 74 |sh word |"then" t|
|00003bb0| 6f 20 0a 74 65 72 6d 69 | 6e 61 74 65 20 74 68 65 |o .termi|nate the|
|00003bc0| 20 63 6f 6e 64 69 74 69 | 6f 6e 61 6c 20 69 73 20 | conditi|onal is |
|00003bd0| 6d 69 73 6c 65 61 64 69 | 6e 67 2c 20 62 75 74 20 |misleadi|ng, but |
|00003be0| 74 68 61 74 20 69 73 20 | 74 68 65 20 77 61 79 20 |that is |the way |
|00003bf0| 69 74 20 69 73 2e 20 20 | 0a 0a 3a 20 61 62 73 76 |it is. |..: absv|
|00003c00| 61 6c 20 20 28 20 6e 20 | 2d 2d 20 61 62 73 6f 6c |al ( n |-- absol|
|00003c10| 75 74 65 5f 76 61 6c 75 | 65 5f 6f 66 5f 6e 20 29 |ute_valu|e_of_n )|
|00003c20| 20 20 64 75 70 20 30 20 | 3c 20 69 66 20 30 20 73 | dup 0 |< if 0 s|
|00003c30| 77 61 70 20 2d 20 74 68 | 65 6e 20 20 3b 0a 0a 4c |wap - th|en ;..L|
|00003c40| 65 74 27 73 20 61 6e 61 | 6c 79 7a 65 20 74 68 69 |et's ana|lyze thi|
|00003c50| 73 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 63 61 72 |s defini|tion car|
|00003c60| 65 66 75 6c 6c 79 2e 20 | 20 46 69 72 73 74 20 6f |efully. | First o|
|00003c70| 66 20 61 6c 6c 2c 20 77 | 68 65 6e 20 74 68 69 73 |f all, w|hen this|
|00003c80| 20 77 6f 72 64 20 0a 65 | 78 65 63 75 74 65 73 2c | word .e|xecutes,|
|00003c90| 20 69 74 20 65 78 70 65 | 63 74 73 20 61 20 6e 75 | it expe|cts a nu|
|00003ca0| 6d 62 65 72 20 74 6f 20 | 62 65 20 6f 6e 20 74 6f |mber to |be on to|
|00003cb0| 70 20 6f 66 20 74 68 65 | 20 73 74 61 63 6b 2e 20 |p of the| stack. |
|00003cc0| 20 43 61 6c 6c 20 74 68 | 65 20 0a 6e 75 6d 62 65 | Call th|e .numbe|
|00003cd0| 72 20 6e 2e 20 20 54 68 | 65 20 66 69 72 73 74 20 |r n. Th|e first |
|00003ce0| 74 68 69 6e 67 20 74 68 | 61 74 20 68 61 70 70 65 |thing th|at happe|
|00003cf0| 6e 73 20 69 73 20 74 68 | 61 74 20 44 55 50 20 69 |ns is th|at DUP i|
|00003d00| 73 20 65 78 65 63 75 74 | 65 64 2c 20 0a 70 75 74 |s execut|ed, .put|
|00003d10| 74 69 6e 67 20 61 6e 6f | 74 68 65 72 20 63 6f 70 |ting ano|ther cop|
|00003d20| 79 20 6f 66 20 6e 20 6f | 6e 20 74 6f 70 20 6f 66 |y of n o|n top of|
|00003d30| 20 74 68 65 20 73 74 61 | 63 6b 2e 20 20 54 68 65 | the sta|ck. The|
|00003d40| 20 73 74 61 63 6b 20 6e | 6f 77 20 6c 6f 6f 6b 73 | stack n|ow looks|
|00003d50| 20 0a 6c 69 6b 65 20 28 | 20 6e 20 6e 20 29 2e 20 | .like (| n n ). |
|00003d60| 20 4e 65 78 74 20 77 65 | 20 68 61 76 65 20 22 30 | Next we| have "0|
|00003d70| 22 2c 20 77 68 69 63 68 | 20 70 75 74 73 20 61 20 |", which| puts a |
|00003d80| 7a 65 72 6f 20 6f 6e 20 | 74 6f 70 20 6f 66 20 74 |zero on |top of t|
|00003d90| 68 65 20 0a 73 74 61 63 | 6b 2c 20 73 6f 20 74 68 |he .stac|k, so th|
|00003da0| 61 74 20 73 74 61 63 6b | 20 6c 6f 6f 6b 73 20 6c |at stack| looks l|
|00003db0| 69 6b 65 20 28 20 6e 20 | 6e 20 30 20 29 2e 20 20 |ike ( n |n 0 ). |
|00003dc0| 54 68 65 6e 20 77 65 20 | 65 78 65 63 75 74 65 20 |Then we |execute |
|00003dd0| 22 3c 22 2c 20 77 68 69 | 63 68 20 0a 63 6f 6d 70 |"<", whi|ch .comp|
|00003de0| 61 72 65 73 20 74 6f 20 | 73 65 65 20 77 68 65 74 |ares to |see whet|
|00003df0| 68 65 72 20 6f 72 20 6e | 6f 74 20 6e 20 69 73 20 |her or n|ot n is |
|00003e00| 6c 65 73 73 20 74 68 61 | 6e 20 30 2e 20 20 54 68 |less tha|n 0. Th|
|00003e10| 65 20 74 77 6f 20 6e 75 | 6d 62 65 72 73 20 74 68 |e two nu|mbers th|
|00003e20| 61 74 20 0a 22 3c 22 20 | 63 6f 6d 70 61 72 65 73 |at ."<" |compares|
|00003e30| 20 61 72 65 20 72 65 6d | 6f 76 65 64 20 66 72 6f | are rem|oved fro|
|00003e40| 6d 20 74 68 65 20 73 74 | 61 63 6b 20 61 6e 64 20 |m the st|ack and |
|00003e50| 61 20 66 6c 61 67 20 69 | 73 20 6c 65 66 74 20 69 |a flag i|s left i|
|00003e60| 6e 73 74 65 61 64 2e 20 | 20 0a 0a 53 75 70 70 6f |nstead. | ..Suppo|
|00003e70| 73 65 20 74 68 61 74 20 | 6e 20 77 61 73 20 2d 35 |se that |n was -5|
|00003e80| 2c 20 73 6f 20 74 68 61 | 74 20 6e 20 72 65 61 6c |, so tha|t n real|
|00003e90| 6c 79 20 77 61 73 20 6c | 65 73 73 20 74 68 61 6e |ly was l|ess than|
|00003ea0| 20 30 2e 20 20 22 3c 22 | 20 77 6f 75 6c 64 20 0a | 0. "<"| would .|
|00003eb0| 74 68 65 6e 20 6c 65 61 | 76 65 20 61 20 2d 31 20 |then lea|ve a -1 |
|00003ec0| 6f 6e 20 74 6f 70 20 6f | 66 20 74 68 65 20 73 74 |on top o|f the st|
|00003ed0| 61 63 6b 2e 20 20 41 6e | 79 20 6e 6f 6e 7a 65 72 |ack. An|y nonzer|
|00003ee0| 6f 20 6e 75 6d 62 65 72 | 20 69 73 20 63 6f 6e 73 |o number| is cons|
|00003ef0| 69 64 65 72 65 64 20 0a | 74 6f 20 6d 65 61 6e 20 |idered .|to mean |
|00003f00| 54 52 55 45 2c 20 77 68 | 65 72 65 61 73 20 7a 65 |TRUE, wh|ereas ze|
|00003f10| 72 6f 20 6d 65 61 6e 73 | 20 46 41 4c 53 45 2e 20 |ro means| FALSE. |
|00003f20| 53 6f 20 74 68 65 20 73 | 74 61 63 6b 20 69 73 20 |So the s|tack is |
|00003f30| 28 20 6e 20 31 20 29 2e | 20 20 49 46 20 0a 74 61 |( n 1 ).| IF .ta|
|00003f40| 6b 65 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |kes the |number o|
|00003f50| 66 66 20 74 68 65 20 74 | 6f 70 20 6f 66 20 74 68 |ff the t|op of th|
|00003f60| 65 20 73 74 61 63 6b 2c | 20 73 65 65 73 20 74 68 |e stack,| sees th|
|00003f70| 61 74 20 69 74 20 69 73 | 20 2d 31 2c 20 61 6e 64 |at it is| -1, and|
|00003f80| 20 0a 70 72 6f 63 65 65 | 64 73 20 74 6f 20 65 78 | .procee|ds to ex|
|00003f90| 65 63 75 74 65 20 30 20 | 53 57 41 50 20 2d 20 2e |ecute 0 |SWAP - .|
|00003fa0| 20 20 54 68 69 73 20 68 | 61 73 20 74 68 65 20 65 | This h|as the e|
|00003fb0| 66 66 65 63 74 20 6f 66 | 20 6e 65 67 61 74 69 6e |ffect of| negatin|
|00003fc0| 67 20 6e 2e 20 20 0a 54 | 68 65 20 63 6f 6d 70 6c |g n. .T|he compl|
|00003fd0| 65 74 65 20 73 65 71 75 | 65 6e 63 65 20 6f 66 20 |ete sequ|ence of |
|00003fe0| 73 74 61 63 6b 20 73 74 | 61 74 65 73 20 69 73 20 |stack st|ates is |
|00003ff0| 0a 0a 28 20 6e 20 29 20 | 20 64 75 70 20 20 28 20 |..( n ) | dup ( |
|00004000| 6e 20 6e 20 29 20 20 30 | 20 20 28 20 6e 20 6e 20 |n n ) 0| ( n n |
|00004010| 30 20 29 20 20 3c 20 20 | 28 20 6e 20 31 20 29 20 |0 ) < |( n 1 ) |
|00004020| 20 69 66 20 20 28 20 6e | 20 29 0a 20 30 20 20 28 | if ( n| ). 0 (|
|00004030| 20 6e 20 30 20 29 20 20 | 73 77 61 70 20 20 28 20 | n 0 ) |swap ( |
|00004040| 30 20 6e 20 29 20 20 2d | 20 20 28 20 2d 6e 20 29 |0 n ) -| ( -n )|
|00004050| 20 20 74 68 65 6e 20 20 | 28 20 2d 6e 20 29 0a 0a | then |( -n )..|
|00004060| 54 68 65 20 54 48 45 4e | 20 74 65 72 6d 69 6e 61 |The THEN| termina|
|00004070| 74 65 73 20 74 68 65 20 | 63 6f 6e 64 69 74 69 6f |tes the |conditio|
|00004080| 6e 61 6c 2e 20 20 0a 0a | 49 66 20 6e 20 68 61 64 |nal. ..|If n had|
|00004090| 20 62 65 65 6e 20 70 6f | 73 69 74 69 76 65 2c 20 | been po|sitive, |
|000040a0| 22 3c 22 20 77 6f 75 6c | 64 20 68 61 76 65 20 6c |"<" woul|d have l|
|000040b0| 65 66 74 20 61 20 7a 65 | 72 6f 2c 20 62 65 63 61 |eft a ze|ro, beca|
|000040c0| 75 73 65 20 30 20 69 73 | 20 6e 6f 74 20 0a 67 72 |use 0 is| not .gr|
|000040d0| 65 61 74 65 72 20 74 68 | 61 6e 20 61 20 70 6f 73 |eater th|an a pos|
|000040e0| 69 74 69 76 65 20 6e 75 | 6d 62 65 72 2e 20 20 49 |itive nu|mber. I|
|000040f0| 46 20 77 6f 75 6c 64 20 | 68 61 76 65 20 74 61 6b |F would |have tak|
|00004100| 65 6e 20 74 68 65 20 7a | 65 72 6f 20 6f 66 66 20 |en the z|ero off |
|00004110| 6f 66 20 0a 74 68 65 20 | 73 74 61 63 6b 20 61 6e |of .the |stack an|
|00004120| 64 20 74 68 65 6e 20 73 | 6b 69 70 70 65 64 20 74 |d then s|kipped t|
|00004130| 68 65 20 73 74 75 66 66 | 20 62 65 74 77 65 65 6e |he stuff| between|
|00004140| 20 49 46 20 61 6e 64 20 | 54 48 45 4e 2e 20 49 66 | IF and |THEN. If|
|00004150| 20 74 68 65 72 65 20 68 | 61 64 20 0a 62 65 65 6e | there h|ad .been|
|00004160| 20 61 6e 20 45 4c 53 45 | 20 63 6c 61 75 73 65 2c | an ELSE| clause,|
|00004170| 20 69 74 20 77 6f 75 6c | 64 20 68 61 76 65 20 62 | it woul|d have b|
|00004180| 65 65 6e 20 65 78 65 63 | 75 74 65 64 2e 20 20 0a |een exec|uted. .|
|00004190| 0a 49 6e 73 74 65 61 64 | 20 6f 66 20 44 55 50 20 |.Instead| of DUP |
|000041a0| 30 20 3c 20 2c 20 77 65 | 20 63 6f 75 6c 64 20 68 |0 < , we| could h|
|000041b0| 61 76 65 20 75 73 65 64 | 20 44 55 50 20 30 3c 20 |ave used| DUP 0< |
|000041c0| 2e 20 20 0a 0a 41 73 20 | 61 20 6d 61 74 74 65 72 |. ..As |a matter|
|000041d0| 20 6f 66 20 66 61 63 74 | 20 74 68 65 72 65 20 69 | of fact| there i|
|000041e0| 73 20 61 6e 20 65 61 73 | 69 65 72 20 77 61 79 20 |s an eas|ier way |
|000041f0| 74 6f 20 6e 65 67 61 74 | 65 20 61 20 6e 75 6d 62 |to negat|e a numb|
|00004200| 65 72 20 74 68 61 6e 20 | 0a 30 20 53 57 41 50 20 |er than |.0 SWAP |
|00004210| 2d 20 2e 20 20 59 6f 75 | 20 63 61 6e 20 6a 75 73 |- . You| can jus|
|00004220| 74 20 75 73 65 20 4e 45 | 47 41 54 45 20 28 20 6e |t use NE|GATE ( n|
|00004230| 20 2d 2d 20 6e 20 29 2e | 20 20 49 6e 20 66 61 63 | -- n ).| In fac|
|00004240| 74 2c 20 61 62 73 76 61 | 6c 20 0a 64 75 70 6c 69 |t, absva|l .dupli|
|00004250| 63 61 74 65 73 20 74 68 | 65 20 66 75 6e 63 74 69 |cates th|e functi|
|00004260| 6f 6e 20 70 72 6f 76 69 | 64 65 64 20 62 79 20 73 |on provi|ded by s|
|00004270| 79 73 74 65 6d 2d 73 75 | 70 70 6c 69 65 64 20 46 |ystem-su|pplied F|
|00004280| 6f 72 74 68 20 77 6f 72 | 64 20 41 42 53 20 28 20 |orth wor|d ABS ( |
|00004290| 6e 20 0a 2d 2d 20 7c 6e | 7c 20 29 2e 20 20 0a 0a |n .-- |n|| ). ..|
|000042a0| 49 46 20 2e 2e 2e 20 20 | 45 4c 53 45 20 2e 2e 2e |IF ... |ELSE ...|
|000042b0| 20 20 54 48 45 4e 20 6d | 61 79 20 62 65 20 6e 65 | THEN m|ay be ne|
|000042c0| 73 74 65 64 20 74 6f 20 | 61 6e 79 20 64 65 70 74 |sted to |any dept|
|000042d0| 68 2c 20 70 72 6f 76 69 | 64 65 64 20 6f 66 20 63 |h, provi|ded of c|
|000042e0| 6f 75 72 73 65 20 0a 74 | 68 61 74 20 74 68 65 72 |ourse .t|hat ther|
|000042f0| 65 20 69 73 20 61 20 54 | 48 45 4e 20 66 6f 72 20 |e is a T|HEN for |
|00004300| 65 76 65 72 79 20 49 46 | 2e 20 49 46 20 6d 61 79 |every IF|. IF may|
|00004310| 20 6f 6e 6c 79 20 62 65 | 20 75 73 65 64 20 77 69 | only be| used wi|
|00004320| 74 68 69 6e 20 63 6f 6c | 6f 6e 20 0a 64 65 66 69 |thin col|on .defi|
|00004330| 6e 69 74 69 6f 6e 73 2c | 20 77 68 69 63 68 20 6d |nitions,| which m|
|00004340| 65 61 6e 73 20 74 68 61 | 74 20 79 6f 75 20 63 61 |eans tha|t you ca|
|00004350| 6e 27 74 20 6a 75 73 74 | 20 74 79 70 65 20 69 6e |n't just| type in|
|00004360| 20 49 46 20 62 6c 61 68 | 2d 62 6c 61 68 2d 62 6c | IF blah|-blah-bl|
|00004370| 61 68 20 0a 54 48 45 4e | 20 75 6e 6c 65 73 73 20 |ah .THEN| unless |
|00004380| 79 6f 75 20 61 72 65 20 | 69 6e 20 74 68 65 20 6d |you are |in the m|
|00004390| 69 64 64 6c 65 20 6f 66 | 20 64 65 66 69 6e 69 6e |iddle of| definin|
|000043a0| 67 20 73 6f 6d 65 20 6f | 74 68 65 72 20 77 6f 72 |g some o|ther wor|
|000043b0| 64 2e 20 20 0a 0a 0a 4c | 6f 6f 70 73 0a 3d 3d 3d |d. ...L|oops.===|
|000043c0| 3d 3d 0a 0a 54 68 65 20 | 62 61 73 69 63 20 6c 6f |==..The |basic lo|
|000043d0| 6f 70 69 6e 67 20 63 6f | 6e 73 74 72 75 63 74 20 |oping co|nstruct |
|000043e0| 69 73 20 74 68 65 20 44 | 4f 20 4c 4f 4f 50 2e 20 |is the D|O LOOP. |
|000043f0| 54 68 65 20 73 74 61 63 | 6b 20 64 69 61 67 72 61 |The stac|k diagra|
|00004400| 6d 20 69 73 20 0a 28 65 | 6e 64 2b 31 20 73 74 61 |m is .(e|nd+1 sta|
|00004410| 72 74 20 2d 2d 20 29 2e | 20 20 45 78 61 6d 70 6c |rt -- ).| Exampl|
|00004420| 65 73 20 61 72 65 20 6e | 65 63 65 73 73 61 72 79 |es are n|ecessary|
|00004430| 2e 20 20 0a 0a 3a 20 70 | 72 69 6e 74 6c 6f 74 73 |. ..: p|rintlots|
|00004440| 20 28 20 6e 39 20 6e 38 | 20 2e 2e 2e 20 6e 31 20 | ( n9 n8| ... n1 |
|00004450| 6e 30 20 2d 2d 20 29 20 | 31 30 20 30 20 64 6f 20 |n0 -- ) |10 0 do |
|00004460| 2e 20 6c 6f 6f 70 20 3b | 0a 0a 77 69 6c 6c 20 70 |. loop ;|..will p|
|00004470| 72 69 6e 74 20 74 65 6e | 20 6e 75 6d 62 65 72 73 |rint ten| numbers|
|00004480| 20 66 72 6f 6d 20 6f 66 | 66 20 6f 66 20 74 68 65 | from of|f of the|
|00004490| 20 73 74 61 63 6b 2e 20 | 20 54 68 65 20 6c 6f 6f | stack. | The loo|
|000044a0| 70 20 77 69 6c 6c 20 73 | 74 61 72 74 20 61 74 20 |p will s|tart at |
|000044b0| 0a 30 20 61 6e 64 20 65 | 6e 64 20 61 66 74 65 72 |.0 and e|nd after|
|000044c0| 20 39 2e 20 20 0a 0a 59 | 6f 75 20 63 61 6e 20 67 | 9. ..Y|ou can g|
|000044d0| 65 74 20 61 74 20 74 68 | 65 20 6c 6f 6f 70 20 69 |et at th|e loop i|
|000044e0| 6e 64 65 78 20 62 79 20 | 75 73 69 6e 67 20 49 20 |ndex by |using I |
|000044f0| 2e 20 20 49 74 20 6c 65 | 61 76 65 73 20 74 68 65 |. It le|aves the|
|00004500| 20 6c 6f 6f 70 20 69 6e | 64 65 78 20 0a 6f 6e 20 | loop in|dex .on |
|00004510| 74 68 65 20 73 74 61 63 | 6b 20 28 77 68 65 72 65 |the stac|k (where|
|00004520| 20 65 6c 73 65 3f 29 2e | 20 20 0a 0a 3a 20 73 75 | else?).| ..: su|
|00004530| 6d 69 74 30 31 30 20 28 | 20 2d 2d 20 73 75 6d 20 |mit010 (| -- sum |
|00004540| 29 20 30 20 31 31 20 31 | 20 64 6f 20 69 20 2b 20 |) 0 11 1| do i + |
|00004550| 6c 6f 6f 70 20 3b 0a 0a | 77 69 6c 6c 20 61 64 64 |loop ;..|will add|
|00004560| 20 75 70 20 74 68 65 20 | 6e 75 6d 62 65 72 73 20 | up the |numbers |
|00004570| 66 72 6f 6d 20 31 20 74 | 6f 20 31 30 20 69 6e 63 |from 1 t|o 10 inc|
|00004580| 6c 75 73 69 76 65 2e 20 | 20 54 68 65 20 22 30 22 |lusive. | The "0"|
|00004590| 20 69 73 20 74 68 65 72 | 65 20 0a 62 65 63 61 75 | is ther|e .becau|
|000045a0| 73 65 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 72 |se the c|urrent r|
|000045b0| 75 6e 6e 69 6e 67 20 73 | 75 6d 20 69 73 20 6b 65 |unning s|um is ke|
|000045c0| 70 74 20 6f 6e 20 74 68 | 65 20 73 74 61 63 6b 2c |pt on th|e stack,|
|000045d0| 20 61 6e 64 20 74 68 65 | 20 73 75 6d 20 0a 6e 65 | and the| sum .ne|
|000045e0| 65 64 73 20 74 6f 20 62 | 65 20 69 6e 69 74 69 61 |eds to b|e initia|
|000045f0| 6c 69 73 65 64 20 74 6f | 20 30 2e 20 20 0a 0a 4c |lised to| 0. ..L|
|00004600| 4f 4f 50 20 6c 69 6d 69 | 74 73 20 64 6f 6e 27 74 |OOP limi|ts don't|
|00004610| 20 68 61 76 65 20 74 6f | 20 62 65 20 70 6f 73 69 | have to| be posi|
|00004620| 74 69 76 65 2e 20 20 54 | 72 79 20 6f 75 74 20 76 |tive. T|ry out v|
|00004630| 61 72 69 6f 75 73 20 6c | 69 6d 69 74 73 20 61 6e |arious l|imits an|
|00004640| 64 20 73 65 65 20 0a 77 | 68 61 74 20 68 61 70 70 |d see .w|hat happ|
|00004650| 65 6e 73 2e 20 20 0a 0a | 3a 20 62 69 67 6a 75 6d |ens. ..|: bigjum|
|00004660| 70 73 20 28 20 2d 2d 20 | 6e 20 29 20 30 20 20 20 |ps ( -- |n ) 0 |
|00004670| 31 30 30 30 20 30 20 64 | 6f 20 69 20 2b 20 20 31 |1000 0 d|o i + 1|
|00004680| 30 20 20 2b 6c 6f 6f 70 | 20 3b 0a 0a 77 69 6c 6c |0 +loop| ;..will|
|00004690| 20 73 75 6d 20 74 68 65 | 20 6d 75 6c 74 69 70 6c | sum the| multipl|
|000046a0| 65 73 20 6f 66 20 31 30 | 20 6c 65 73 73 20 74 68 |es of 10| less th|
|000046b0| 61 6e 20 31 30 30 30 2e | 20 20 2b 4c 4f 4f 50 20 |an 1000.| +LOOP |
|000046c0| 69 6e 63 72 65 6d 65 6e | 74 73 20 74 68 65 20 0a |incremen|ts the .|
|000046d0| 6c 6f 6f 70 20 69 6e 64 | 65 78 20 62 79 20 61 20 |loop ind|ex by a |
|000046e0| 6e 75 6d 62 65 72 20 74 | 68 61 74 20 69 74 20 74 |number t|hat it t|
|000046f0| 61 6b 65 73 20 66 72 6f | 6d 20 74 68 65 20 73 74 |akes fro|m the st|
|00004700| 61 63 6b 2c 20 69 6e 20 | 74 68 69 73 20 63 61 73 |ack, in |this cas|
|00004710| 65 20 31 30 2e 20 20 0a | 59 6f 75 20 63 61 6e 20 |e 10. .|You can |
|00004720| 72 75 6e 20 6c 6f 6f 70 | 73 20 62 61 63 6b 77 61 |run loop|s backwa|
|00004730| 72 64 73 20 69 66 20 79 | 6f 75 20 77 69 73 68 2c |rds if y|ou wish,|
|00004740| 20 62 79 20 75 73 69 6e | 67 20 2b 4c 4f 4f 50 20 | by usin|g +LOOP |
|00004750| 77 69 74 68 20 61 20 0a | 6e 65 67 61 74 69 76 65 |with a .|negative|
|00004760| 20 69 6e 63 72 65 6d 65 | 6e 74 2e 20 20 0a 0a 59 | increme|nt. ..Y|
|00004770| 6f 75 20 6d 61 79 20 70 | 72 65 6d 61 74 75 72 65 |ou may p|remature|
|00004780| 6c 79 20 65 78 69 74 20 | 66 72 6f 6d 20 61 20 44 |ly exit |from a D|
|00004790| 4f 20 4c 4f 4f 50 20 62 | 79 20 65 78 65 63 75 74 |O LOOP b|y execut|
|000047a0| 69 6e 67 20 4c 45 41 56 | 45 20 77 69 74 68 69 6e |ing LEAV|E within|
|000047b0| 20 74 68 65 20 0a 6c 6f | 6f 70 2e 20 20 59 6f 75 | the .lo|op. You|
|000047c0| 20 70 72 6f 62 61 62 6c | 79 20 77 61 6e 74 20 74 | probabl|y want t|
|000047d0| 6f 20 65 6e 63 6c 6f 73 | 65 20 74 68 65 20 4c 45 |o enclos|e the LE|
|000047e0| 41 56 45 20 69 6e 20 61 | 6e 20 49 46 20 2e 2e 2e |AVE in a|n IF ...|
|000047f0| 20 20 54 48 45 4e 20 0a | 73 74 72 75 63 74 75 72 | THEN .|structur|
|00004800| 65 2c 20 62 65 63 61 75 | 73 65 20 69 74 20 64 6f |e, becau|se it do|
|00004810| 65 73 6e 27 74 20 6d 61 | 6b 65 20 73 65 6e 73 65 |esn't ma|ke sense|
|00004820| 20 74 6f 20 63 6f 6e 73 | 74 72 75 63 74 20 61 20 | to cons|truct a |
|00004830| 6c 6f 6f 70 20 77 68 69 | 63 68 20 0a 61 6c 77 61 |loop whi|ch .alwa|
|00004840| 79 73 20 65 78 69 74 73 | 20 61 66 74 65 72 20 74 |ys exits| after t|
|00004850| 68 65 20 66 69 72 73 74 | 20 74 69 6d 65 73 20 74 |he first| times t|
|00004860| 68 72 6f 75 67 68 2e 20 | 20 0a 0a 4d 6f 72 65 20 |hrough. | ..More |
|00004870| 67 65 6e 65 72 61 6c 20 | 6c 6f 6f 70 73 20 6d 61 |general |loops ma|
|00004880| 79 20 62 65 20 63 6f 6e | 73 74 72 75 63 74 65 64 |y be con|structed|
|00004890| 20 77 69 74 68 20 0a 0a | 62 65 67 69 6e 20 2e 2e | with ..|begin ..|
|000048a0| 2e 20 75 6e 74 69 6c 20 | 20 20 20 20 20 20 6f 72 |. until | or|
|000048b0| 0a 62 65 67 69 6e 20 2e | 2e 2e 20 77 68 69 6c 65 |.begin .|.. while|
|000048c0| 20 2e 2e 2e 20 72 65 70 | 65 61 74 0a 0a 49 6e 20 | ... rep|eat..In |
|000048d0| 74 68 65 20 63 61 73 65 | 20 6f 66 20 42 45 47 49 |the case| of BEGI|
|000048e0| 4e 20 2e 2e 2e 20 20 55 | 4e 54 49 4c 2c 20 74 68 |N ... U|NTIL, th|
|000048f0| 65 20 73 74 61 63 6b 20 | 69 73 20 63 68 65 63 6b |e stack |is check|
|00004900| 65 64 20 62 79 20 55 4e | 54 49 4c 2e 20 49 66 20 |ed by UN|TIL. If |
|00004910| 69 66 20 0a 69 73 20 7a | 65 72 6f 2c 20 6c 6f 6f |if .is z|ero, loo|
|00004920| 70 69 6e 67 20 63 6f 6e | 74 69 6e 75 65 73 20 61 |ping con|tinues a|
|00004930| 74 20 42 45 47 49 4e 2e | 20 49 66 20 69 74 20 69 |t BEGIN.| If it i|
|00004940| 73 20 6f 6e 65 2c 20 65 | 78 65 63 75 74 69 6f 6e |s one, e|xecution|
|00004950| 20 63 6f 6e 74 69 6e 75 | 65 73 20 0a 61 66 74 65 | continu|es .afte|
|00004960| 72 20 55 4e 54 49 4c 2e | 20 0a 0a 46 6f 72 20 42 |r UNTIL.| ..For B|
|00004970| 45 47 49 4e 20 2e 2e 2e | 20 20 57 48 49 4c 45 20 |EGIN ...| WHILE |
|00004980| 2e 2e 2e 20 20 52 45 50 | 45 41 54 2c 20 57 48 49 |... REP|EAT, WHI|
|00004990| 4c 45 20 63 68 65 63 6b | 73 20 74 68 65 20 73 74 |LE check|s the st|
|000049a0| 61 63 6b 2e 20 20 49 66 | 20 69 74 20 69 73 20 31 |ack. If| it is 1|
|000049b0| 2c 20 0a 6c 6f 6f 70 69 | 6e 67 20 70 72 6f 63 65 |, .loopi|ng proce|
|000049c0| 65 64 73 2c 20 66 69 72 | 73 74 20 65 78 65 63 75 |eds, fir|st execu|
|000049d0| 74 69 6e 67 20 74 68 65 | 20 73 74 75 66 66 20 62 |ting the| stuff b|
|000049e0| 65 74 77 65 65 6e 20 57 | 48 49 4c 45 20 61 6e 64 |etween W|HILE and|
|000049f0| 20 52 45 50 45 41 54 2c | 20 0a 74 68 65 6e 20 73 | REPEAT,| .then s|
|00004a00| 74 61 72 74 69 6e 67 20 | 6f 76 65 72 20 61 74 20 |tarting |over at |
|00004a10| 42 45 47 49 4e 2e 20 49 | 66 20 57 48 49 4c 45 20 |BEGIN. I|f WHILE |
|00004a20| 66 6f 75 6e 64 20 61 20 | 7a 65 72 6f 20 6f 6e 20 |found a |zero on |
|00004a30| 74 68 65 20 73 74 61 63 | 6b 2c 20 74 68 65 20 0a |the stac|k, the .|
|00004a40| 73 74 75 66 66 20 62 65 | 74 77 65 65 6e 20 57 48 |stuff be|tween WH|
|00004a50| 49 4c 45 20 61 6e 64 20 | 52 45 50 45 41 54 20 69 |ILE and |REPEAT i|
|00004a60| 73 20 73 6b 69 70 70 65 | 64 20 61 6e 64 20 65 78 |s skippe|d and ex|
|00004a70| 65 63 75 74 69 6f 6e 20 | 63 6f 6e 74 69 6e 75 65 |ecution |continue|
|00004a80| 73 20 0a 61 66 74 65 72 | 20 22 72 65 70 65 61 74 |s .after| "repeat|
|00004a90| 22 2e 20 20 0a 0a 57 65 | 6c 6c 2c 20 63 61 6d 70 |". ..We|ll, camp|
|00004aa0| 65 72 73 2c 20 69 74 27 | 73 20 65 78 61 6d 70 6c |ers, it'|s exampl|
|00004ab0| 65 20 74 69 6d 65 20 61 | 67 61 69 6e 2e 20 20 54 |e time a|gain. T|
|00004ac0| 68 69 73 20 74 69 6d 65 | 20 77 65 27 6c 6c 20 61 |his time| we'll a|
|00004ad0| 73 73 75 6d 65 20 74 68 | 61 74 20 0a 74 68 65 72 |ssume th|at .ther|
|00004ae0| 65 20 69 73 20 61 20 74 | 61 62 6c 65 20 73 6f 6d |e is a t|able som|
|00004af0| 65 77 68 65 72 65 20 69 | 6e 20 6d 65 6d 6f 72 79 |ewhere i|n memory|
|00004b00| 2e 20 20 54 68 69 73 20 | 74 61 62 6c 65 20 63 6f |. This |table co|
|00004b10| 6e 73 69 73 74 73 20 6f | 66 20 38 2d 77 6f 72 64 |nsists o|f 8-word|
|00004b20| 20 0a 65 6e 74 72 69 65 | 73 2c 20 61 6e 64 20 74 | .entrie|s, and t|
|00004b30| 68 65 20 65 6e 64 20 6f | 66 20 74 68 65 20 74 61 |he end o|f the ta|
|00004b40| 62 6c 65 20 69 73 20 66 | 6c 61 67 67 65 64 20 62 |ble is f|lagged b|
|00004b50| 79 20 61 20 2d 31 20 69 | 6e 20 74 68 65 20 66 69 |y a -1 i|n the fi|
|00004b60| 72 73 74 20 77 6f 72 64 | 20 0a 6f 66 20 74 68 65 |rst word| .of the|
|00004b70| 20 6c 61 73 74 20 65 6e | 74 72 79 2e 20 20 57 65 | last en|try. We|
|00004b80| 20 77 6f 75 6c 64 20 6c | 69 6b 65 20 74 6f 20 73 | would l|ike to s|
|00004b90| 63 61 6e 20 74 68 72 6f | 75 67 68 20 74 68 65 20 |can thro|ugh the |
|00004ba0| 74 61 62 6c 65 20 61 6e | 64 20 61 64 64 20 61 20 |table an|d add a |
|00004bb0| 0a 6e 75 6d 62 65 72 20 | 74 6f 20 74 68 65 20 74 |.number |to the t|
|00004bc0| 68 69 72 64 20 77 6f 72 | 64 20 69 6e 20 65 61 63 |hird wor|d in eac|
|00004bd0| 68 20 65 6e 74 72 79 2e | 20 20 54 68 69 73 20 74 |h entry.| This t|
|00004be0| 68 69 72 64 20 77 6f 72 | 64 20 72 65 70 72 65 73 |hird wor|d repres|
|00004bf0| 65 6e 74 73 20 0a 74 68 | 65 20 61 67 65 20 6f 66 |ents .th|e age of|
|00004c00| 20 61 6e 20 65 6d 70 6c | 6f 79 65 65 2c 20 73 6f | an empl|oyee, so|
|00004c10| 20 77 65 27 6c 6c 20 63 | 61 6c 6c 20 69 74 20 41 | we'll c|all it A|
|00004c20| 47 45 20 2e 20 20 4f 75 | 72 20 6f 70 65 72 61 74 |GE . Ou|r operat|
|00004c30| 69 6f 6e 20 77 69 6c 6c | 20 0a 6d 61 6b 65 20 65 |ion will| .make e|
|00004c40| 76 65 72 79 62 6f 64 79 | 20 6f 6c 64 65 72 2e 20 |verybody| older. |
|00004c50| 20 53 74 75 64 79 20 74 | 68 69 73 20 65 78 61 6d | Study t|his exam|
|00004c60| 70 6c 65 20 63 61 72 65 | 66 75 6c 6c 79 2e 20 20 |ple care|fully. |
|00004c70| 49 74 20 73 68 6f 77 73 | 20 68 6f 77 20 0a 46 6f |It shows| how .Fo|
|00004c80| 72 74 68 20 70 72 6f 67 | 72 61 6d 73 20 73 68 6f |rth prog|rams sho|
|00004c90| 75 6c 64 20 62 65 20 63 | 6f 6e 73 74 72 75 63 74 |uld be c|onstruct|
|00004ca0| 65 64 20 77 69 74 68 20 | 73 69 6d 70 6c 65 20 77 |ed with |simple w|
|00004cb0| 6f 72 64 73 2e 20 20 0a | 0a 3a 20 61 67 65 20 20 |ords. .|.: age |
|00004cc0| 28 20 65 6e 74 72 79 5f | 61 64 72 20 2d 2d 20 61 |( entry_|adr -- a|
|00004cd0| 67 65 5f 61 64 72 20 29 | 20 20 5c 20 63 6f 6e 76 |ge_adr )| \ conv|
|00004ce0| 65 72 74 73 20 65 6e 74 | 72 79 20 61 64 72 20 74 |erts ent|ry adr t|
|00004cf0| 6f 20 61 67 65 20 61 64 | 72 0a 20 20 20 31 32 20 |o age ad|r. 12 |
|00004d00| 2b 0a 3b 0a 3a 20 61 64 | 64 69 6e 20 20 28 20 6e |+.;.: ad|din ( n|
|00004d10| 20 61 64 72 20 2d 2d 20 | 6e 20 61 64 72 20 29 20 | adr -- |n adr ) |
|00004d20| 20 5c 20 61 64 64 73 20 | 6e 20 74 6f 20 74 68 65 | \ adds |n to the|
|00004d30| 20 6e 75 6d 62 65 72 20 | 61 74 20 61 64 72 0a 20 | number |at adr. |
|00004d40| 20 20 6f 76 65 72 20 6f | 76 65 72 20 20 20 20 20 | over o|ver |
|00004d50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 20 | | \ |
|00004d60| 63 6f 70 79 20 62 6f 74 | 68 20 6e 20 61 6e 64 20 |copy bot|h n and |
|00004d70| 61 64 72 0a 20 20 20 61 | 67 65 20 2b 21 20 20 20 |adr. a|ge +! |
|00004d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004d90| 20 20 20 5c 20 69 6e 63 | 72 65 61 73 65 20 61 67 | \ inc|rease ag|
|00004da0| 65 20 62 79 20 6e 0a 3b | 0a 3a 20 6d 6f 72 65 3f |e by n.;|.: more?|
|00004db0| 20 20 28 20 61 64 72 20 | 2d 2d 20 61 64 72 20 66 | ( adr |-- adr f|
|00004dc0| 6c 61 67 20 29 20 20 5c | 20 66 6c 61 67 20 69 73 |lag ) \| flag is|
|00004dd0| 20 66 61 6c 73 65 20 69 | 66 66 20 61 64 72 20 70 | false i|ff adr p|
|00004de0| 6f 69 6e 74 73 20 74 6f | 20 61 20 2d 31 0a 20 20 |oints to| a -1. |
|00004df0| 20 64 75 70 20 40 20 2d | 31 20 3c 3e 0a 3b 0a 3a | dup @ -|1 <>.;.:|
|00004e00| 20 2b 65 6e 74 72 79 20 | 20 28 20 61 64 72 31 20 | +entry | ( adr1 |
|00004e10| 2d 2d 20 61 64 72 32 20 | 29 20 20 5c 20 61 64 76 |-- adr2 |) \ adv|
|00004e20| 61 6e 63 65 73 20 74 6f | 20 74 68 65 20 6e 65 78 |ances to| the nex|
|00004e30| 74 20 65 6e 74 72 79 0a | 20 20 20 33 32 20 2b 0a |t entry.| 32 +.|
|00004e40| 3b 0a 3a 20 6f 6c 64 65 | 72 20 20 28 20 6e 20 61 |;.: olde|r ( n a|
|00004e50| 64 72 20 2d 2d 20 29 20 | 20 5c 20 61 64 64 73 20 |dr -- ) | \ adds |
|00004e60| 6e 20 74 6f 20 65 61 63 | 68 20 61 67 65 20 69 6e |n to eac|h age in|
|00004e70| 20 74 61 62 6c 65 20 61 | 74 20 61 64 72 0a 20 20 | table a|t adr. |
|00004e80| 20 62 65 67 69 6e 20 20 | 6d 6f 72 65 3f 20 20 77 | begin |more? w|
|00004e90| 68 69 6c 65 20 20 61 64 | 64 69 6e 20 2b 65 6e 74 |hile ad|din +ent|
|00004ea0| 72 79 20 20 72 65 70 65 | 61 74 20 20 64 72 6f 70 |ry repe|at drop|
|00004eb0| 20 64 72 6f 70 0a 3b 0a | 0a 0a 53 75 70 70 6f 73 | drop.;.|..Suppos|
|00004ec0| 69 6e 67 20 74 68 61 74 | 20 74 68 65 72 65 20 69 |ing that| there i|
|00004ed0| 73 20 61 20 77 6f 72 64 | 20 45 4d 50 4c 4f 59 45 |s a word| EMPLOYE|
|00004ee0| 45 53 20 77 68 69 63 68 | 20 72 65 74 75 72 6e 73 |ES which| returns|
|00004ef0| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|00004f00| 0a 73 75 63 68 20 61 20 | 74 61 62 6c 65 2c 20 77 |.such a |table, w|
|00004f10| 65 20 63 6f 75 6c 64 20 | 6d 61 6b 65 20 61 20 65 |e could |make a e|
|00004f20| 76 65 72 79 62 6f 64 79 | 20 31 30 30 20 79 65 61 |verybody| 100 yea|
|00004f30| 72 73 20 6f 6c 64 65 72 | 20 62 79 20 74 79 70 69 |rs older| by typi|
|00004f40| 6e 67 20 0a 0a 31 30 30 | 20 65 6d 70 6c 6f 79 65 |ng ..100| employe|
|00004f50| 65 73 20 6f 6c 64 65 72 | 0a 0a 4e 6f 74 69 63 65 |es older|..Notice|
|00004f60| 20 74 68 61 74 20 49 20 | 77 61 73 20 63 61 72 65 | that I |was care|
|00004f70| 66 75 6c 20 74 6f 20 64 | 65 66 69 6e 65 20 65 61 |ful to d|efine ea|
|00004f80| 63 68 20 77 6f 72 64 20 | 62 65 66 6f 72 65 20 49 |ch word |before I|
|00004f90| 20 75 73 65 64 20 69 74 | 20 69 6e 73 69 64 65 20 | used it| inside |
|00004fa0| 0a 61 6e 6f 74 68 65 72 | 20 77 6f 72 64 2e 20 20 |.another| word. |
|00004fb0| 54 68 69 73 20 69 73 20 | 61 20 72 65 71 75 69 72 |This is |a requir|
|00004fc0| 65 6d 65 6e 74 20 77 69 | 74 68 20 74 79 70 69 63 |ement wi|th typic|
|00004fd0| 61 6c 20 46 6f 72 74 68 | 20 73 79 73 74 65 6d 73 |al Forth| systems|
|00004fe0| 2e 20 20 0a 54 68 65 72 | 65 20 69 73 20 6e 6f 20 |. .Ther|e is no |
|00004ff0| 22 66 6f 72 77 61 72 64 | 20 72 65 66 65 72 65 6e |"forward| referen|
|00005000| 63 69 6e 67 22 2c 20 73 | 6f 20 65 76 65 72 79 74 |cing", s|o everyt|
|00005010| 68 69 6e 67 20 6d 75 73 | 74 20 62 65 20 64 65 66 |hing mus|t be def|
|00005020| 69 6e 65 64 20 0a 62 65 | 66 6f 72 65 20 69 74 20 |ined .be|fore it |
|00005030| 69 73 20 75 73 65 64 2e | 20 20 54 68 69 73 20 6d |is used.| This m|
|00005040| 61 79 20 73 65 65 6d 20 | 61 72 63 68 61 69 63 2c |ay seem |archaic,|
|00005050| 20 62 75 74 20 69 6e 20 | 66 61 63 74 20 69 74 20 | but in |fact it |
|00005060| 69 73 20 73 65 6c 64 6f | 6d 20 0a 65 76 65 72 20 |is seldo|m .ever |
|00005070| 6d 69 73 73 65 64 2e 20 | 20 54 68 65 20 70 61 79 |missed. | The pay|
|00005080| 6f 66 66 20 69 73 20 67 | 72 65 61 74 2c 20 69 6e |off is g|reat, in|
|00005090| 20 74 65 72 6d 73 20 6f | 66 20 72 65 64 75 63 65 | terms o|f reduce|
|000050a0| 64 20 63 6f 6d 70 69 6c | 65 72 20 0a 63 6f 6d 70 |d compil|er .comp|
|000050b0| 6c 65 78 69 74 79 20 61 | 6e 64 20 63 6f 6e 63 65 |lexity a|nd conce|
|000050c0| 70 74 75 61 6c 20 73 69 | 6d 70 6c 69 63 69 74 79 |ptual si|mplicity|
|000050d0| 2e 20 20 54 68 65 72 65 | 20 61 72 65 20 46 6f 72 |. There| are For|
|000050e0| 74 68 20 0a 22 63 72 6f | 73 73 2d 63 6f 6d 70 69 |th ."cro|ss-compi|
|000050f0| 6c 65 72 22 20 61 6e 64 | 20 22 6d 65 74 61 2d 63 |ler" and| "meta-c|
|00005100| 6f 6d 70 69 6c 65 72 22 | 20 70 72 6f 67 72 61 6d |ompiler"| program|
|00005110| 73 20 77 68 69 63 68 20 | 61 6c 6c 6f 77 20 66 6f |s which |allow fo|
|00005120| 72 77 61 72 64 20 0a 72 | 65 66 65 72 65 6e 63 65 |rward .r|eference|
|00005130| 73 20 74 6f 20 76 61 72 | 79 69 6e 67 20 64 65 67 |s to var|ying deg|
|00005140| 72 65 65 2c 20 62 75 74 | 20 74 68 65 79 20 61 72 |ree, but| they ar|
|00005150| 65 20 67 65 6e 65 72 61 | 6c 6c 79 20 75 73 65 64 |e genera|lly used|
|00005160| 20 74 6f 20 62 75 69 6c | 64 20 0a 65 6e 74 69 72 | to buil|d .entir|
|00005170| 65 20 46 6f 72 74 68 20 | 6b 65 72 6e 65 6c 73 20 |e Forth |kernels |
|00005180| 66 72 6f 6d 20 73 63 72 | 61 74 63 68 2e 20 20 0a |from scr|atch. .|
|00005190| 0a 4e 6f 77 20 73 75 70 | 70 6f 73 65 20 77 65 20 |.Now sup|pose we |
|000051a0| 77 61 6e 74 20 74 6f 20 | 70 72 69 6e 74 20 6f 75 |want to |print ou|
|000051b0| 74 20 6d 75 6c 74 69 70 | 6c 65 73 20 6f 66 20 32 |t multip|les of 2|
|000051c0| 20 75 6e 74 69 6c 20 74 | 68 65 20 75 73 65 72 20 | until t|he user |
|000051d0| 74 79 70 65 73 20 61 20 | 0a 6b 65 79 20 6f 6e 20 |types a |.key on |
|000051e0| 68 69 73 20 6b 65 79 62 | 6f 61 72 64 2c 20 61 74 |his keyb|oard, at|
|000051f0| 20 77 68 69 63 68 20 74 | 69 6d 65 20 77 65 20 77 | which t|ime we w|
|00005200| 61 6e 74 20 74 6f 20 73 | 74 6f 70 2e 20 20 54 68 |ant to s|top. Th|
|00005210| 65 72 65 20 69 73 20 61 | 20 77 6f 72 64 20 0a 4b |ere is a| word .K|
|00005220| 45 59 3f 20 77 68 69 63 | 68 20 72 65 74 75 72 6e |EY? whic|h return|
|00005230| 73 20 74 72 75 65 20 69 | 66 20 74 68 65 20 75 73 |s true i|f the us|
|00005240| 65 72 20 68 61 73 20 74 | 79 70 65 64 20 73 6f 6d |er has t|yped som|
|00005250| 65 74 68 69 6e 67 20 73 | 69 6e 63 65 20 74 68 65 |ething s|ince the|
|00005260| 20 6c 61 73 74 20 0a 74 | 69 6d 65 20 77 65 20 63 | last .t|ime we c|
|00005270| 68 65 63 6b 65 64 2c 20 | 30 20 6f 74 68 65 72 77 |hecked, |0 otherw|
|00005280| 69 73 65 2e 20 20 0a 0a | 3a 20 6d 75 6c 74 73 2d |ise. ..|: mults-|
|00005290| 6f 66 2d 32 20 20 28 20 | 2d 2d 20 29 20 20 30 20 |of-2 ( |-- ) 0 |
|000052a0| 20 62 65 67 69 6e 20 20 | 64 75 70 20 2e 20 32 20 | begin |dup . 2 |
|000052b0| 2b 20 20 6b 65 79 3f 20 | 20 75 6e 74 69 6c 20 20 |+ key? | until |
|000052c0| 64 72 6f 70 20 20 3b 0a | 0a 4f 66 20 63 6f 75 72 |drop ;.|.Of cour|
|000052d0| 73 65 2c 20 74 68 69 73 | 20 63 6f 75 6c 64 20 68 |se, this| could h|
|000052e0| 61 76 65 20 62 65 65 6e | 20 64 6f 6e 65 20 61 73 |ave been| done as|
|000052f0| 20 0a 0a 3a 20 6d 75 6c | 74 73 2d 6f 66 2d 32 20 | ..: mul|ts-of-2 |
|00005300| 20 28 20 2d 2d 20 29 20 | 20 33 32 37 36 36 20 30 | ( -- ) | 32766 0|
|00005310| 20 20 64 6f 20 20 69 20 | 2e 20 20 6b 65 79 3f 20 | do i |. key? |
|00005320| 20 69 66 20 6c 65 61 76 | 65 20 74 68 65 6e 20 20 | if leav|e then |
|00005330| 32 20 2b 6c 6f 6f 70 20 | 20 3b 0a 0a 62 75 74 20 |2 +loop | ;..but |
|00005340| 74 68 65 20 72 65 61 6c | 20 70 6f 69 6e 74 20 68 |the real| point h|
|00005350| 65 72 65 20 77 61 73 20 | 74 6f 20 69 6c 6c 75 73 |ere was |to illus|
|00005360| 74 72 61 74 65 20 74 68 | 65 20 42 45 47 49 4e 20 |trate th|e BEGIN |
|00005370| 2e 2e 2e 20 20 55 4e 54 | 49 4c 20 2e 20 20 0a 0a |... UNT|IL . ..|
|00005380| 6b 65 79 3f 20 20 28 20 | 2d 2d 20 66 6c 61 67 20 |key? ( |-- flag |
|00005390| 29 20 20 20 20 20 20 69 | 6e 70 75 74 20 61 6e 64 |) i|nput and|
|000053a0| 20 6f 75 74 70 75 74 0a | 20 20 20 20 20 20 20 20 | output.| |
|000053b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 66 | | f|
|000053c0| 6c 61 67 20 69 73 20 74 | 72 75 65 20 69 66 20 61 |lag is t|rue if a|
|000053d0| 20 6b 65 79 20 68 61 73 | 20 62 65 65 6e 20 74 79 | key has| been ty|
|000053e0| 70 65 64 2e 0a 6b 65 79 | 20 20 28 20 2d 2d 20 63 |ped..key| ( -- c|
|000053f0| 68 61 72 20 29 20 20 20 | 20 20 20 20 6b 65 79 20 |har ) | key |
|00005400| 77 61 69 74 73 20 75 6e | 74 69 6c 20 74 68 65 20 |waits un|til the |
|00005410| 75 73 65 72 20 74 79 70 | 65 73 20 61 20 63 68 61 |user typ|es a cha|
|00005420| 72 61 63 74 65 72 2c 20 | 74 68 65 6e 0a 20 20 20 |racter, |then. |
|00005430| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005440| 20 20 20 20 72 65 74 75 | 72 6e 73 20 74 68 65 20 | retu|rns the |
|00005450| 63 68 61 72 61 63 74 65 | 72 0a 65 6d 69 74 20 20 |characte|r.emit |
|00005460| 28 20 63 68 61 72 20 2d | 2d 20 29 20 20 20 20 20 |( char -|- ) |
|00005470| 20 65 6d 69 74 20 64 69 | 73 70 6c 61 79 73 20 74 | emit di|splays t|
|00005480| 68 65 20 63 68 61 72 20 | 6f 6e 20 74 68 65 20 74 |he char |on the t|
|00005490| 65 72 6d 69 6e 61 6c 0a | 73 70 61 63 65 20 20 28 |erminal.|space (|
|000054a0| 20 2d 2d 20 29 20 20 20 | 20 20 20 20 20 20 20 64 | -- ) | d|
|000054b0| 69 73 70 6c 61 79 73 20 | 61 20 73 70 61 63 65 20 |isplays |a space |
|000054c0| 63 68 61 72 61 63 74 65 | 72 2e 0a 63 72 20 20 28 |characte|r..cr (|
|000054d0| 20 2d 2d 20 29 20 20 20 | 20 20 20 20 20 20 20 20 | -- ) | |
|000054e0| 20 20 64 69 73 70 6c 61 | 79 73 20 61 20 63 61 72 | displa|ys a car|
|000054f0| 72 69 61 67 65 20 72 65 | 74 75 72 6e 2c 20 6c 69 |riage re|turn, li|
|00005500| 6e 65 20 66 65 65 64 0a | 73 70 61 63 65 73 20 20 |ne feed.|spaces |
|00005510| 28 20 6e 20 2d 2d 20 29 | 20 20 20 20 20 20 20 64 |( n -- )| d|
|00005520| 69 73 70 6c 61 79 73 20 | 6e 20 73 70 61 63 65 73 |isplays |n spaces|
|00005530| 0a 74 79 70 65 20 20 28 | 20 61 64 72 20 6e 20 2d |.type (| adr n -|
|00005540| 2d 20 29 20 20 20 20 20 | 64 69 73 70 6c 61 79 73 |- ) |displays|
|00005550| 20 6e 20 63 68 61 72 61 | 63 74 65 72 73 2c 20 62 | n chara|cters, b|
|00005560| 65 67 69 6e 6e 69 6e 67 | 20 61 74 20 61 64 72 0a |eginning| at adr.|
|00005570| 2e 22 20 73 74 72 69 6e | 67 20 6f 66 20 63 68 61 |." strin|g of cha|
|00005580| 72 61 63 74 65 72 73 20 | 74 6f 20 64 69 73 70 6c |racters |to displ|
|00005590| 61 79 22 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ay". | |
|000055a0| 20 20 20 20 20 20 20 20 | 20 20 20 68 65 72 65 20 | | here |
|000055b0| 79 6f 75 20 61 63 74 75 | 61 6c 6c 79 20 68 61 76 |you actu|ally hav|
|000055c0| 65 20 74 6f 20 74 79 70 | 65 20 74 68 65 0a 20 20 |e to typ|e the. |
|000055d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000055e0| 20 20 20 20 20 64 6f 75 | 62 6c 65 2d 71 75 6f 74 | dou|ble-quot|
|000055f0| 65 20 63 68 61 72 61 63 | 74 65 72 73 2e 20 20 54 |e charac|ters. T|
|00005600| 68 65 20 73 74 72 69 6e | 67 20 73 74 61 72 74 73 |he strin|g starts|
|00005610| 20 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00005620| 20 20 20 20 20 20 20 20 | 20 61 66 74 65 72 20 74 | | after t|
|00005630| 68 65 20 73 70 61 63 65 | 20 66 6f 6c 6c 6f 77 69 |he space| followi|
|00005640| 6e 67 20 74 68 65 20 66 | 69 72 73 74 20 71 75 6f |ng the f|irst quo|
|00005650| 74 65 2c 20 0a 20 20 20 | 20 20 20 20 20 20 20 20 |te, . | |
|00005660| 20 20 20 20 20 20 20 20 | 20 20 20 20 61 6e 64 20 | | and |
|00005670| 63 6f 6e 74 69 6e 75 65 | 73 20 75 70 20 74 6f 20 |continue|s up to |
|00005680| 62 75 74 20 6e 6f 74 20 | 69 6e 63 6c 75 64 69 6e |but not |includin|
|00005690| 67 20 74 68 65 20 0a 20 | 20 20 20 20 20 20 20 20 |g the . | |
|000056a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 6c 61 | | la|
|000056b0| 73 74 20 71 75 6f 74 65 | 2e 0a 65 78 70 65 63 74 |st quote|..expect|
|000056c0| 20 20 28 20 61 64 72 20 | 6e 20 2d 2d 20 29 20 20 | ( adr |n -- ) |
|000056d0| 20 61 63 63 65 70 74 73 | 20 6e 20 63 68 61 72 61 | accepts| n chara|
|000056e0| 63 74 65 72 73 20 66 72 | 6f 6d 20 74 68 65 20 74 |cters fr|om the t|
|000056f0| 65 72 6d 69 6e 61 6c 2c | 0a 20 20 20 20 20 20 20 |erminal,|. |
|00005700| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005710| 73 74 6f 72 69 6e 67 20 | 74 68 65 6d 20 61 74 20 |storing |them at |
|00005720| 61 64 64 72 2e 20 20 49 | 66 20 61 20 63 61 72 72 |addr. I|f a carr|
|00005730| 69 61 67 65 20 72 65 74 | 75 72 6e 20 69 73 0a 20 |iage ret|urn is. |
|00005740| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005750| 20 20 20 20 20 20 74 79 | 70 65 64 20 62 65 66 6f | ty|ped befo|
|00005760| 72 65 20 6e 20 63 68 61 | 72 61 63 74 65 72 73 20 |re n cha|racters |
|00005770| 68 61 76 65 20 62 65 65 | 6e 0a 20 20 20 20 20 20 |have bee|n. |
|00005780| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005790| 20 61 63 63 75 6d 75 6c | 61 74 65 64 2c 20 65 78 | accumul|ated, ex|
|000057a0| 70 65 63 74 20 66 69 6c | 6c 73 20 6f 75 74 20 74 |pect fil|ls out t|
|000057b0| 68 65 20 72 65 73 74 20 | 6f 66 20 74 68 65 0a 20 |he rest |of the. |
|000057c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000057d0| 20 20 20 20 20 20 6e 20 | 6c 6f 63 61 74 69 6f 6e | n |location|
|000057e0| 73 20 77 69 74 68 20 6e | 75 6c 6c 73 0a 2d 74 72 |s with n|ulls.-tr|
|000057f0| 61 69 6c 69 6e 67 20 20 | 28 20 61 64 72 20 6e 6c |ailing |( adr nl|
|00005800| 20 2d 2d 20 61 64 72 20 | 6e 32 20 29 0a 20 20 20 | -- adr |n2 ). |
|00005810| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005820| 20 20 20 20 72 65 64 75 | 63 65 73 20 74 68 65 20 | redu|ces the |
|00005830| 63 68 61 72 61 63 74 65 | 72 20 63 6f 75 6e 74 20 |characte|r count |
|00005840| 6e 31 20 73 6f 20 74 68 | 61 74 0a 20 20 20 20 20 |n1 so th|at. |
|00005850| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005860| 20 20 74 72 61 69 6c 69 | 6e 67 20 62 6c 61 6e 6b | traili|ng blank|
|00005870| 73 20 61 72 65 20 6f 6d | 69 74 74 65 64 20 0a 63 |s are om|itted .c|
|00005880| 6f 75 6e 74 20 20 28 20 | 61 64 72 20 2d 2d 20 61 |ount ( |adr -- a|
|00005890| 64 72 2b 31 20 6e 20 29 | 0a 20 20 20 20 20 20 20 |dr+1 n )|. |
|000058a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000058b0| 63 6f 6e 76 65 72 74 73 | 20 61 20 70 61 63 6b 65 |converts| a packe|
|000058c0| 64 20 73 74 72 69 6e 67 | 20 74 6f 20 61 6e 20 61 |d string| to an a|
|000058d0| 64 64 72 65 73 73 20 61 | 6e 64 0a 20 20 20 20 20 |ddress a|nd. |
|000058e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000058f0| 20 20 63 68 61 72 61 63 | 74 65 72 20 63 6f 75 6e | charac|ter coun|
|00005900| 74 0a 0a 41 20 77 6f 72 | 64 20 61 62 6f 75 74 20 |t..A wor|d about |
|00005910| 43 4f 55 4e 54 20 69 73 | 20 69 6e 20 6f 72 64 65 |COUNT is| in orde|
|00005920| 72 2e 20 20 46 6f 72 74 | 68 20 73 74 6f 72 65 73 |r. Fort|h stores|
|00005930| 20 73 74 72 69 6e 67 73 | 20 61 73 20 61 20 6c 65 | strings| as a le|
|00005940| 6e 67 74 68 20 62 79 74 | 65 20 0a 66 6f 6c 6c 6f |ngth byt|e .follo|
|00005950| 77 65 64 20 62 79 20 61 | 20 6e 75 6d 62 65 72 20 |wed by a| number |
|00005960| 6f 66 20 63 68 61 72 61 | 63 74 65 72 73 2e 20 20 |of chara|cters. |
|00005970| 54 68 65 20 6c 65 6e 67 | 74 68 20 62 79 74 65 20 |The leng|th byte |
|00005980| 63 6f 6e 74 61 69 6e 73 | 20 74 68 65 20 0a 6e 75 |contains| the .nu|
|00005990| 6d 62 65 72 20 6f 66 20 | 63 68 61 72 61 63 74 65 |mber of |characte|
|000059a0| 72 73 20 69 6e 20 74 68 | 65 20 73 74 72 69 6e 67 |rs in th|e string|
|000059b0| 2c 20 6e 6f 74 20 69 6e | 63 6c 75 64 69 6e 67 20 |, not in|cluding |
|000059c0| 74 68 65 20 6c 65 6e 67 | 74 68 20 62 79 74 65 2e |the leng|th byte.|
|000059d0| 20 20 0a 43 4f 55 4e 54 | 20 74 61 6b 65 73 20 74 | .COUNT| takes t|
|000059e0| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 61 20 |he addre|ss of a |
|000059f0| 70 61 63 6b 65 64 20 73 | 74 72 69 6e 67 2c 20 77 |packed s|tring, w|
|00005a00| 68 69 63 68 20 69 73 20 | 74 68 65 20 61 64 64 72 |hich is |the addr|
|00005a10| 65 73 73 20 6f 66 20 0a | 69 74 73 20 6c 65 6e 67 |ess of .|its leng|
|00005a20| 74 68 20 62 79 74 65 2c | 20 61 6e 64 20 72 65 74 |th byte,| and ret|
|00005a30| 75 72 6e 73 20 74 68 65 | 20 61 64 64 72 65 73 73 |urns the| address|
|00005a40| 20 6f 66 20 74 68 65 20 | 61 63 74 75 61 6c 20 63 | of the |actual c|
|00005a50| 68 61 72 61 63 74 65 72 | 73 20 69 6e 20 0a 74 68 |haracter|s in .th|
|00005a60| 65 20 73 74 72 69 6e 67 | 2c 20 77 68 69 63 68 20 |e string|, which |
|00005a70| 69 73 20 31 20 6d 6f 72 | 65 20 74 68 61 6e 20 74 |is 1 mor|e than t|
|00005a80| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |he addre|ss of th|
|00005a90| 65 20 6c 65 6e 67 74 68 | 20 62 79 74 65 2e 20 20 |e length| byte. |
|00005aa0| 4f 6e 20 0a 74 6f 70 20 | 6f 66 20 74 68 61 74 2c |On .top |of that,|
|00005ab0| 20 69 74 20 72 65 74 75 | 72 6e 73 20 74 68 65 20 | it retu|rns the |
|00005ac0| 76 61 6c 75 65 20 6f 66 | 20 74 68 65 20 6c 65 6e |value of| the len|
|00005ad0| 67 74 68 20 62 79 74 65 | 2e 20 20 0a 0a 4e 6f 74 |gth byte|. ..Not|
|00005ae0| 65 20 74 68 61 74 20 46 | 6f 72 74 68 20 61 64 64 |e that F|orth add|
|00005af0| 72 65 73 73 65 73 20 61 | 72 65 20 62 79 74 65 20 |resses a|re byte |
|00005b00| 61 64 64 72 65 73 73 65 | 73 2e 20 20 49 66 20 79 |addresse|s. If y|
|00005b10| 6f 75 20 61 64 64 20 31 | 20 74 6f 20 61 20 46 6f |ou add 1| to a Fo|
|00005b20| 72 74 68 20 0a 61 64 64 | 72 65 73 73 2c 20 79 6f |rth .add|ress, yo|
|00005b30| 75 20 67 65 74 20 74 68 | 65 20 6e 65 78 74 20 62 |u get th|e next b|
|00005b40| 79 74 65 2e 20 20 54 6f | 20 67 65 74 20 74 68 65 |yte. To| get the|
|00005b50| 20 6e 65 78 74 20 77 6f | 72 64 2c 20 79 6f 75 20 | next wo|rd, you |
|00005b60| 68 61 76 65 20 74 6f 20 | 61 64 64 20 0a 32 2e 20 |have to |add .2. |
|00005b70| 20 0a 0a 4e 6f 72 6d 61 | 6c 6c 79 2c 20 77 68 65 | ..Norma|lly, whe|
|00005b80| 6e 20 79 6f 75 20 61 72 | 65 20 74 79 70 69 6e 67 |n you ar|e typing|
|00005b90| 20 46 6f 72 74 68 20 77 | 6f 72 64 73 20 66 6f 72 | Forth w|ords for|
|00005ba0| 20 69 74 20 74 6f 20 65 | 78 65 63 75 74 65 2c 20 | it to e|xecute, |
|00005bb0| 74 68 65 79 20 61 72 65 | 20 0a 62 65 69 6e 67 20 |they are| .being |
|00005bc0| 73 74 6f 72 65 64 20 69 | 6e 20 61 20 62 75 66 66 |stored i|n a buff|
|00005bd0| 65 72 20 63 61 6c 6c 65 | 64 20 74 68 65 20 22 74 |er calle|d the "t|
|00005be0| 65 72 6d 69 6e 61 6c 20 | 69 6e 70 75 74 20 62 75 |erminal |input bu|
|00005bf0| 66 66 65 72 22 2e 20 20 | 54 6f 20 0a 65 78 65 63 |ffer". |To .exec|
|00005c00| 75 74 65 20 74 68 65 20 | 6e 65 78 74 20 77 6f 72 |ute the |next wor|
|00005c10| 64 2c 20 69 74 20 66 69 | 72 73 74 20 68 61 73 20 |d, it fi|rst has |
|00005c20| 74 6f 20 62 65 20 66 65 | 74 63 68 65 64 20 66 72 |to be fe|tched fr|
|00005c30| 6f 6d 20 74 68 65 20 74 | 65 72 6d 69 6e 61 6c 20 |om the t|erminal |
|00005c40| 0a 69 6e 70 75 74 20 62 | 75 66 66 65 72 2e 20 20 |.input b|uffer. |
|00005c50| 54 6f 20 64 6f 20 74 68 | 69 73 2c 20 61 20 77 6f |To do th|is, a wo|
|00005c60| 72 64 20 63 61 6c 6c 65 | 64 20 57 4f 52 44 20 69 |rd calle|d WORD i|
|00005c70| 73 20 65 78 65 63 75 74 | 65 64 2e 20 20 57 4f 52 |s execut|ed. WOR|
|00005c80| 44 20 74 61 6b 65 73 20 | 0a 74 68 65 20 6e 65 78 |D takes |.the nex|
|00005c90| 74 20 77 6f 72 64 20 66 | 72 6f 6d 20 74 68 65 20 |t word f|rom the |
|00005ca0| 74 65 72 6d 69 6e 61 6c | 20 69 6e 70 75 74 20 62 |terminal| input b|
|00005cb0| 75 66 66 65 72 20 61 6e | 64 20 73 74 6f 72 65 73 |uffer an|d stores|
|00005cc0| 20 69 74 20 61 73 20 61 | 20 70 61 63 6b 65 64 20 | it as a| packed |
|00005cd0| 0a 73 74 72 69 6e 67 2c | 20 74 68 65 6e 20 72 65 |.string,| then re|
|00005ce0| 74 75 72 6e 73 20 74 68 | 65 20 61 64 64 72 65 73 |turns th|e addres|
|00005cf0| 73 20 6f 66 20 74 68 65 | 20 70 61 63 6b 65 64 20 |s of the| packed |
|00005d00| 73 74 72 69 6e 67 2e 20 | 20 54 68 65 20 62 6f 75 |string. | The bou|
|00005d10| 6e 64 61 72 79 20 0a 62 | 65 74 77 65 65 6e 20 6f |ndary .b|etween o|
|00005d20| 6e 65 20 77 6f 72 64 20 | 61 6e 64 20 74 68 65 20 |ne word |and the |
|00005d30| 6e 65 78 74 20 69 73 20 | 64 65 6e 6f 74 65 64 20 |next is |denoted |
|00005d40| 62 79 20 61 20 73 70 61 | 63 65 20 63 68 61 72 61 |by a spa|ce chara|
|00005d50| 63 74 65 72 2e 20 20 0a | 41 63 74 75 61 6c 6c 79 |cter. .|Actually|
|00005d60| 2c 20 57 4f 52 44 20 61 | 63 63 65 70 74 73 20 61 |, WORD a|ccepts a|
|00005d70| 6e 20 61 72 67 75 6d 65 | 6e 74 20 77 68 69 63 68 |n argume|nt which|
|00005d80| 20 74 65 6c 6c 73 20 69 | 74 20 77 68 61 74 20 74 | tells i|t what t|
|00005d90| 6f 20 75 73 65 20 61 73 | 20 74 68 65 20 0a 73 65 |o use as| the .se|
|00005da0| 70 61 72 61 74 6f 72 20 | 63 68 61 72 61 63 74 65 |parator |characte|
|00005db0| 72 2e 20 20 4e 6f 72 6d | 61 6c 6c 79 2c 20 73 70 |r. Norm|ally, sp|
|00005dc0| 61 63 65 20 69 73 20 75 | 73 65 64 2c 20 62 75 74 |ace is u|sed, but|
|00005dd0| 20 69 66 20 79 6f 75 20 | 77 61 6e 74 20 74 6f 20 | if you |want to |
|00005de0| 75 73 65 20 0a 57 4f 52 | 44 20 79 6f 75 72 73 65 |use .WOR|D yourse|
|00005df0| 6c 66 2c 20 79 6f 75 20 | 61 72 65 20 66 72 65 65 |lf, you |are free|
|00005e00| 20 74 6f 20 63 68 6f 73 | 65 20 79 6f 75 72 20 6f | to chos|e your o|
|00005e10| 77 6e 20 64 65 6c 69 6d | 69 74 65 72 2e 20 20 0a |wn delim|iter. .|
|00005e20| 0a 77 6f 72 64 20 20 5c | 20 77 6f 72 64 20 20 28 |.word \| word (|
|00005e30| 20 64 65 6c 69 6d 69 74 | 65 72 5f 63 68 61 72 20 | delimit|er_char |
|00005e40| 2d 2d 20 61 64 72 20 29 | 0a 20 20 20 20 20 20 20 |-- adr )|. |
|00005e50| 20 20 20 20 20 20 20 20 | 20 61 63 63 65 70 74 73 | | accepts|
|00005e60| 20 74 68 65 20 6e 65 78 | 74 20 77 6f 72 64 2c 20 | the nex|t word, |
|00005e70| 6f 72 20 73 65 71 75 65 | 6e 63 65 20 6f 66 20 63 |or seque|nce of c|
|00005e80| 68 61 72 61 63 74 65 72 | 73 20 6e 6f 74 0a 20 20 |haracter|s not. |
|00005e90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 69 6e | | in|
|00005ea0| 63 6c 75 64 69 6e 67 20 | 74 68 65 20 64 65 6c 69 |cluding |the deli|
|00005eb0| 6d 69 74 65 72 5f 63 68 | 61 72 2c 20 66 72 6f 6d |miter_ch|ar, from|
|00005ec0| 20 74 68 65 20 69 6e 70 | 75 74 20 73 74 72 65 61 | the inp|ut strea|
|00005ed0| 6d 2e 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |m.. | |
|00005ee0| 20 20 20 53 74 6f 72 65 | 73 20 69 74 20 61 73 20 | Store|s it as |
|00005ef0| 61 20 70 61 63 6b 65 64 | 20 73 74 72 69 6e 67 20 |a packed| string |
|00005f00| 61 6e 64 20 72 65 74 75 | 72 6e 73 20 69 74 73 20 |and retu|rns its |
|00005f10| 61 64 64 72 65 73 73 0a | 20 20 20 20 20 20 20 20 |address.| |
|00005f20| 20 20 20 20 20 20 20 20 | 28 74 68 65 20 61 64 64 | |(the add|
|00005f30| 72 65 73 73 20 6f 66 20 | 74 68 65 20 6c 65 6e 67 |ress of |the leng|
|00005f40| 74 68 20 62 79 74 65 29 | 2e 0a 0a 0a 4e 75 6d 65 |th byte)|....Nume|
|00005f50| 72 69 63 20 49 2f 4f 0a | 3d 3d 3d 3d 3d 3d 3d 3d |ric I/O.|========|
|00005f60| 3d 3d 3d 0a 0a 57 65 20 | 68 61 76 65 20 61 6c 72 |===..We |have alr|
|00005f70| 65 61 64 79 20 73 65 65 | 6e 20 68 6f 77 20 74 6f |eady see|n how to|
|00005f80| 20 75 73 65 20 22 2e 22 | 20 41 6c 73 6f 2c 20 77 | use "."| Also, w|
|00005f90| 65 20 68 61 76 65 20 73 | 65 65 6e 20 74 68 61 74 |e have s|een that|
|00005fa0| 20 6e 75 6d 62 65 72 73 | 20 0a 6d 61 79 20 62 65 | numbers| .may be|
|00005fb0| 20 70 75 74 20 6f 6e 20 | 74 68 65 20 73 74 61 63 | put on |the stac|
|00005fc0| 6b 20 73 69 6d 70 6c 79 | 20 62 79 20 74 79 70 69 |k simply| by typi|
|00005fd0| 6e 67 20 74 68 65 20 6e | 75 6d 62 65 72 2e 20 20 |ng the n|umber. |
|00005fe0| 4d 6f 72 65 20 6f 70 74 | 69 6f 6e 73 20 61 72 65 |More opt|ions are|
|00005ff0| 20 0a 61 76 61 69 6c 61 | 62 6c 65 2c 20 73 75 63 | .availa|ble, suc|
|00006000| 68 20 61 73 20 61 63 63 | 65 70 74 69 6e 67 20 6f |h as acc|epting o|
|00006010| 72 20 74 79 70 69 6e 67 | 20 68 65 78 61 64 65 63 |r typing| hexadec|
|00006020| 69 6d 61 6c 20 6e 75 6d | 62 65 72 73 2e 20 20 0a |imal num|bers. .|
|00006030| 0a 62 61 73 65 20 20 28 | 20 2d 2d 20 61 64 72 20 |.base (| -- adr |
|00006040| 29 20 20 20 20 20 61 20 | 76 61 72 69 61 62 6c 65 |) a |variable|
|00006050| 20 77 68 69 63 68 20 63 | 6f 6e 74 61 69 6e 73 20 | which c|ontains |
|00006060| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 74 68 65 |the valu|e of the|
|00006070| 20 63 75 72 72 65 6e 74 | 0a 20 20 20 20 20 20 20 | current|. |
|00006080| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 6e 75 | | nu|
|00006090| 6d 65 72 69 63 20 69 6e | 70 75 74 20 61 6e 64 20 |meric in|put and |
|000060a0| 6f 75 74 70 75 74 20 62 | 61 73 65 2e 0a 68 65 78 |output b|ase..hex|
|000060b0| 20 20 28 20 2d 2d 20 29 | 20 20 20 20 20 20 20 20 | ( -- )| |
|000060c0| 20 20 73 65 74 73 20 62 | 61 73 65 20 74 6f 20 31 | sets b|ase to 1|
|000060d0| 36 20 28 20 64 65 66 61 | 75 6c 74 20 77 68 65 6e |6 ( defa|ult when|
|000060e0| 20 72 75 6e 6e 69 6e 67 | 20 73 74 61 6e 64 20 61 | running| stand a|
|000060f0| 6c 6f 6e 65 20 29 0a 64 | 65 63 69 6d 61 6c 20 20 |lone ).d|ecimal |
|00006100| 28 20 2d 2d 20 29 20 20 | 20 20 20 20 73 65 74 73 |( -- ) | sets|
|00006110| 20 62 61 73 65 20 74 6f | 20 31 30 20 28 20 74 68 | base to| 10 ( th|
|00006120| 65 20 64 65 66 61 75 6c | 74 20 77 68 65 6e 20 72 |e defaul|t when r|
|00006130| 75 6e 6e 69 6e 67 20 75 | 6e 64 65 72 20 75 6e 69 |unning u|nder uni|
|00006140| 78 20 29 0a 2e 20 20 28 | 20 6e 20 2d 2d 20 29 20 |x ).. (| n -- ) |
|00006150| 20 20 20 20 20 20 20 20 | 20 64 69 73 70 6c 61 79 | | display|
|00006160| 73 20 6e 20 61 63 63 6f | 72 64 69 6e 67 20 74 6f |s n acco|rding to|
|00006170| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 42 41 53 | the cur|rent BAS|
|00006180| 45 0a 75 2e 20 20 28 20 | 75 20 2d 2d 20 29 20 20 |E.u. ( |u -- ) |
|00006190| 20 20 20 20 20 20 20 64 | 69 73 70 6c 61 79 73 20 | d|isplays |
|000061a0| 75 20 61 73 20 61 6e 20 | 75 6e 73 69 67 6e 65 64 |u as an |unsigned|
|000061b0| 20 6e 75 6d 62 65 72 0a | 2e 72 20 20 28 20 6e 20 | number.|.r ( n |
|000061c0| 72 20 2d 2d 20 29 20 20 | 20 20 20 20 20 64 69 73 |r -- ) | dis|
|000061d0| 70 6c 61 79 73 20 6e 20 | 72 69 67 68 74 2d 6a 75 |plays n |right-ju|
|000061e0| 73 74 69 66 69 65 64 20 | 69 6e 20 61 20 66 69 65 |stified |in a fie|
|000061f0| 6c 64 20 6f 66 20 77 69 | 64 74 68 20 72 0a 75 2e |ld of wi|dth r.u.|
|00006200| 72 20 20 28 20 75 20 72 | 20 2d 2d 20 29 20 20 20 |r ( u r| -- ) |
|00006210| 20 20 20 6c 69 6b 65 20 | 22 2e 72 22 2c 20 62 75 | like |".r", bu|
|00006220| 74 20 75 6e 73 69 67 6e | 65 64 0a 3f 20 20 28 20 |t unsign|ed.? ( |
|00006230| 61 64 72 20 2d 2d 20 29 | 20 20 20 20 20 20 20 20 |adr -- )| |
|00006240| 64 69 73 70 6c 61 79 73 | 20 74 68 65 20 63 6f 6e |displays| the con|
|00006250| 74 65 6e 74 73 20 6f 66 | 20 74 68 65 20 6d 65 6d |tents of| the mem|
|00006260| 6f 72 79 20 6c 6f 63 61 | 74 69 6f 6e 20 61 74 20 |ory loca|tion at |
|00006270| 61 64 64 72 65 73 73 0a | 20 20 20 20 20 20 20 20 |address.| |
|00006280| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 61 64 72 | | adr|
|00006290| 2e 20 45 71 75 69 76 61 | 6c 65 6e 74 20 74 6f 20 |. Equiva|lent to |
|000062a0| 22 40 20 2e 22 0a 2e 73 | 20 20 28 20 2d 2d 20 29 |"@ ."..s| ( -- )|
|000062b0| 20 20 20 20 20 20 20 20 | 20 20 20 64 69 73 70 6c | | displ|
|000062c0| 61 79 73 20 74 68 65 20 | 65 6e 74 69 72 65 20 73 |ays the |entire s|
|000062d0| 74 61 63 6b 20 63 6f 6e | 74 65 6e 74 73 20 77 69 |tack con|tents wi|
|000062e0| 74 68 6f 75 74 20 72 65 | 6d 6f 76 69 6e 67 0a 20 |thout re|moving. |
|000062f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006300| 20 20 20 20 61 6e 79 74 | 68 69 6e 67 20 66 72 6f | anyt|hing fro|
|00006310| 6d 20 74 68 65 20 73 74 | 61 63 6b 0a 0a 0a 4e 6f |m the st|ack...No|
|00006320| 74 65 20 74 68 61 74 20 | 65 78 65 63 75 74 69 6e |te that |executin|
|00006330| 67 20 42 41 53 45 20 40 | 20 2e 20 69 73 20 75 73 |g BASE @| . is us|
|00006340| 65 6c 65 73 73 20 61 73 | 20 61 20 77 61 79 20 74 |eless as| a way t|
|00006350| 6f 20 66 69 6e 64 20 6f | 75 74 20 77 68 61 74 20 |o find o|ut what |
|00006360| 74 68 65 20 0a 63 75 72 | 72 65 6e 74 20 76 61 6c |the .cur|rent val|
|00006370| 75 65 20 6f 66 20 42 41 | 53 45 20 69 73 2e 20 20 |ue of BA|SE is. |
|00006380| 59 6f 75 20 77 69 6c 6c | 20 61 6c 77 61 79 73 20 |You will| always |
|00006390| 67 65 74 20 31 30 20 61 | 73 20 74 68 65 20 61 6e |get 10 a|s the an|
|000063a0| 73 77 65 72 20 0a 62 65 | 63 61 75 73 65 20 77 68 |swer .be|cause wh|
|000063b0| 61 74 65 76 65 72 20 42 | 41 53 45 20 69 73 2c 20 |atever B|ASE is, |
|000063c0| 69 74 20 77 69 6c 6c 20 | 62 65 20 74 79 70 65 64 |it will |be typed|
|000063d0| 20 61 73 20 22 31 30 22 | 20 61 63 63 6f 72 64 69 | as "10"| accordi|
|000063e0| 6e 67 20 74 6f 20 69 74 | 73 20 0a 6f 77 6e 20 62 |ng to it|s .own b|
|000063f0| 61 73 65 2e 20 20 49 66 | 20 79 6f 75 20 77 61 6e |ase. If| you wan|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.